# Need script to copy specific .txt files

October 1, 2010 at 03:02:00
Specs: Windows XP, Pent.4 / 2 gig
 Hello,I need help writing script to copy 60+ 'specifically named' .txt files fromone folder to another. The farthest I've gotten is-copy "c:\fubar1\abc.txt" "c:\fubar2\abc.txt"That copies abc.txt, but putting def.txt after the abc.txt gives me "cannot find file"Thx

See More: Need script to copy specific .txt files

#1
October 1, 2010 at 21:20:08
 What are these specifically names files?Are there any similarities?----You might be able to stick it in a loop, and get it done in a line or two. Get back to me.Can I put a question here?

Report •

#2
October 2, 2010 at 19:14:20
 That's the problem. The only similarities are that they are .txt files. Wildcards are out of the question. Other than that, they have xxxxcv, xxxxfisc, xxxxinv. The xxxx are 60 plus differently named files.

Report •

#3
October 2, 2010 at 20:44:27
 copy *.txt c:\destination  GNU win32 packages | Gawk

Report •

Related Solutions

#4
October 3, 2010 at 18:22:32
 The problem with that ghostdog is what happens if there are more text files in the folder that he doesn't want moved?You might have to spend a bit of time and manually type them all in...COPY "P:\a\t\h\File1.txt+File2.txt+Fil..." "P:\a\t\h\"Can I put a question here?

Report •

#5
October 4, 2010 at 02:33:48
 I tried that, but nothing gets copied. Typing in all those .txt files is no problem. I just can't seem to find a 'command, argument, symbol' that allows me to string all those files in the specified folder.The only thing I saw that worked was replicating -----copy "c:\*\abc.txt" "c:\%\abc.txt"copy "c:\*\def.txt" "c:\%\def.txt"copy "c:\*\ghi.txt" "c:\%\ghi.txt"If that's the only way, so be it. Since I'm new to scripting, I thought there'd be a different way.

Report •

#6
October 4, 2010 at 12:33:51
 If you want to right all of the names of the files you want to move in a text file, you can use this:FOR /f %%a IN (FileName.txt) DO ( COPY "P:\a\t\h\%%a" "P:\a\t\h\%%a" )----C:\Users\Matt\Desktop>FOR /f %a IN (Names.txt) DO (COPY "Folder 1\%a" "Folder 2\ %a") C:\Users\Matt\Desktop>(COPY "Folder 1\123.txt" "Folder 2\123.txt" ) 1 file(s) copied. C:\Users\Matt\Desktop>(COPY "Folder 1\456.txt" "Folder 2\456.txt" ) 1 file(s) copied. C:\Users\Matt\Desktop>(COPY "Folder 1\789.txt" "Folder 2\789.txt" ) 1 file(s) copied. Can I put a question here?

Report •

#7
October 5, 2010 at 01:50:45
 Thanks so much! Here's the working script---@echo offcd C:\Users\Myself\Desktop\EOM\FOR %a IN (abc.txt def.txt ghi.txt) DO (COPY "C:\Users\Curtis\Desktop\EOM\%a" "C:\Users\Myself\Desktop\EOM2\%a")

Report •