1.

Solve : how to loop files in a folder which has space in it?

Answer»

Hi
I have the following CODE to copy files from a list. When the path of the files which the folder NAME has no space, it works perfectly. But the folder names could have space sometimes, how can I improve the code to handle the folder name with space

FOR /F %%a in (find_file_list.txt) DO COPY "%%a" "C:\test\%%~nxa"

BASICALLY, in this find_file_list.txt, there list all files with path

c:\abc\def\12345.txt
c:\abc\def\12346.txt
c:\abc\def\12347.txt

the above code copy all these three files into folder of test and works fine.
Now when find_file_list.txt change, actually the REAL folder name has space in it, like

c:\ab c\de f\12345.txt
c:\ab c\de f\12346.txt
c:\ab c\de f\12347.txt

the above code not working anymore...
any thoughts?
Thanls
Pretty sure you have been shown how to properly read a file in several of your questions on other forums. Not sure how you keep forgetting to do THINGS.



Discussion

No Comment Found