Windows batch- copy command + append

Pwyl_The_Destroyer

Limp Gawd
Joined
Aug 22, 2005
Messages
139
I'm trying to use the windows copy command to concatenate a series of text files into one, but the default order seems to be alphabetical, and I would like to copy them in Date-Modified order.

I'm currently using the command like this:
copy *.txt out.txt

How would I go about doing this?
 
Just to be clear -- do you want the filenames in "out.txt", or the contents of each file to be appended into "out.txt" ??
 
The contents of each file. It's already doing that with the syntax I posted, but the data isn't appended in the order that I want.
 
this will do it:

for /f "delims=" %1 in ('dir /b /o *.txt') do type %1 >> out.txt

as long as you want to output the text in filename order.
 
I understand most of what you're doing there, but it didn't do anything.
I'm obviously not a pro at windows scripting, do I need to do anything other than put your code into a .bat file and run it in the same directory as the files?

Also, I needed it in date order, but I figured that part out (dir /b /od *.txt)

edit-
never mind, I got it. "%1" becomes "%%1" when you place the command in a batch file.

Thanks!
 
Back
Top