I have a text file (SingleFilesList.txt) listing a
series of files including their path in the form
T:\A test directory\3\E\0\123456789.jpg
T:\A test directory\3\F\5\123456790.jpg
T:\A test directory\F\1\2\123456789.jpg
I would like to copy all the files listed into one
folder. I have used at the DOS command
prompt:
For /F "tokens=*" %K in (SingleFilesList.txt)
Do Copy "%K" V:\Test\
No errors are generated but files are not
copied to V:\Test. Please can anyone
suggest where I am going wrong?
For Loop Using Text File As Input Problem
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Re: For Loop Using Text File As Input Problem
Is that all on one line?
If there is no ouput on the screen, my first guess is that it can't find singlefileslist.txt . . .
for /f "usebackq delims=" %a in ("c:\path to file\singlefileslist.txt") do copy "%a" v:\test
If there is no ouput on the screen, my first guess is that it can't find singlefileslist.txt . . .
Re: For Loop Using Text File As Input Problem
Thank you for your reply. At first the command didn't work but your comment about SingleFilesList.txt caused me to look at the file in a hex editor. For some reason a single FF character preceded the first T. Deleting this character solved it.
Your command
worked as did
which someone had suggested on another forum.
Thanks again for your help.
Your command
for /f "usebackq delims=" %a in ("c:\path to file\singlefileslist.txt") do copy "%a" v:\test
worked as did
For /F "tokens=*" %K in (SingleFilesList.txt) Do (Copy "%K" V:\Test\)
which someone had suggested on another forum.
Thanks again for your help.