Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How copy specific type of file into a folder?
#1
Because i just learned programming ,when i wanted to achieve the following features, Have encountered difficulties, I wanted someone to help me, thanks! :oops:

The current situation :

1.C drive has a folder: fold1, in this folder, contains a lot of sub-folders, such as: subfold1 subfold2 subfold3 subfold4 subfold5 ... ...

2. In each subfolder, there are many formats of files, such as: a.doc b.txt c.mp4 d.mp3 ...

What I want to do :

1. On the desktop, create a new folder, the name is txtfold

2. Then: copy the txt type of files in all subfolders of the fold1 folder to the txtfold folder

3. Finally: on the desktop to generate a txt file, the file name is txtfile, fold1 folder all the txt type of file name, write to the txtfile file (including the file path, for example: c:\fold1\subfold1\b.txt)
Reply
#2
I would use function GetFilesInFolder.
Reply
#3
I use the following code, get the required txt file, but how to copy them to the txtfold folder? thank you very much!

Macro Macro2
Code:
Select All      Help
ARRAY(str) a
GetFilesInFolder a "c:\fold1" "*.txt" 4
out a
Reply
#4
In the following code, the out output is:
abc
def
And in the notepad to enter, is a space
Why is this the result? Hope someone can help me, thank you very much

Macro Macro2
Code:
Select All      Help
ARRAY(str) a.create(3)
a[0]="abc"
a[1]="bcd"
out a
run "notepad"
key (a)
Reply
#5
Use paste (s) to succeed Smile
Reply
#6
do not open notepad directly write into the document? with which function? thank you very much Smile
Reply
#7
Use the following code to write the file successfully
But copy the text file to the textfold folder code, I can not write, hope someone can help me, any suggestions are welcome, thank you very much :oops:

_s=(a); _s.setfile("$desktop$\textfile.txt")
Reply
#8
Use the following code, successful, very grateful to QM Smile

Macro Macro6
Code:
Select All      Help
Dir d
foreach(d "c:\fold1\*.txt" FE_Dir 4)
,str path=d.FullPath
,cop path "$desktop$\textfold"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)