For loop using text file as input problem

June 21, 2010 at 02:37:39
Specs: W2003
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

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?

See More: For loop using text file as input problem

Report •

June 21, 2010 at 08:19:06
For /F "tokens=*" %K in (SingleFilesList.txt) Do (Copy "%K" V:\Test\)

Helping others achieve escape felicity


Report •

June 21, 2010 at 22:22:10
Thank you for your reply. At first the command didn't work
but a comment about SingleFilesList.txt on another forum
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
For /F "tokens=*" %K in (SingleFilesList.txt) Do (Copy
"%K" V:\Test\)

worked as did

for /f "usebackq delims=" %a in ("c:\path to
file\singlefileslist.txt") do copy "%a" v:\test

which someone had suggested on another forum.

Thanks again for your help.

Report •
Related Solutions

Ask Question