Windows Programming help

  • Thread starter Thread starter Hassan
  • Start date Start date
H

Hassan

I have a directory say c:\test with a set of text files...

I want to be able to loop through all the files and append the text in all
of them together into one single text file.

How can I do so ?

Thanks
 
Hassan said:
I have a directory say c:\test with a set of text files...

I want to be able to loop through all the files and append the text in all
of them together into one single text file.

How can I do so ?

Thanks

You can do it like so:
copy "c:\Some Folder\*.txt" c:\Sum.txt

Simple, isn't it?
 
Yes,

DOS 101 indeed :-)

Hassan - Pegasus's way will work fine. I did't think of the easy way first.

Only thing to watch out for is if you move to files _other_ than text, then
you need to add a /b (binary) to the copy command.

copy /b "c:\Some Folder\*.dat" c:\Sum.dat

Regards,

CreateWindow ( Pegasus - I guess the OP's subject "Windows Programming"
got me too excited :)
 
CreateWindow said:
Yes,

DOS 101 indeed :-)

Hassan - Pegasus's way will work fine. I did't think of the easy way first.

Only thing to watch out for is if you move to files _other_ than text, then
you need to add a /b (binary) to the copy command.

copy /b "c:\Some Folder\*.dat" c:\Sum.dat

Regards,

CreateWindow ( Pegasus - I guess the OP's subject "Windows Programming"
got me too excited :)

It confused me too but then I remembered to apply the KISS
principle . . . :-)

You make a good point with the /b switch but I would warn the
OP about combining binary files. The result is unlikely to be
useable.
 
True. Although /b would not hurt text. Cheers.
Pegasus (MVP) said:
It confused me too but then I remembered to apply the KISS
principle . . . :-)

You make a good point with the /b switch but I would warn the
OP about combining binary files. The result is unlikely to be
useable.
 
Yeah its those DOS 101 that I need a class on ;)

I think the solution you offered for the text file will work. Its just that
I am not smart to think about it
 
Back
Top