How to pass a spaced path directory to robocopy?
I need to transfer some files in huge amount using robocopy. Usually, I will transform the directory (from path with spaces to non-spaces) then use robocopy. But now, I can not do that due to privilege & efficiency.
The flow is simple : read filename from txt and copy.
I had looking and try many things and seems going nowhere.
@echo off
set src_folder=C:\foo bar\lorem ipsum\
set dst_folder=C:\Users\asd\Desktop\copyFileImageFromMagentoFolder\photo_temp20\
for /f "tokens=*" %%i in (list.txt) do robocopy %src_folder% %dst_folder% %%i
Pause
This code work flawlessly if there is no spaces on path directory.
And i tired to modify my code. Add some syntax :
@echo off
set src_folder=C:\foo bar\lorem ipsum\
set dst_folder=C:\Users\asd\Desktop\copyFileImageFromMagentoFolder\photo_temp20\
for /f "tokens=*" %%i in (list.txt) do robocopy "%src_folder%\%%i" "%dst_folder%\%%i"
Pause
But, robocopy throw me error 123 and error 2 (as i remember).
As a note, the folder and file is exist. So please never ask me that question.
Any suggestion will be appreciate