Please note: you can't use wildcards with
(and please make
dir_list for clarity.)
for /f "delims=" %%a IN (%dir_list%) do (
if "!dir:~-1!"=="\" set dir=!dir:~0,-1!
move "!dir!" "%dest_folder%\"
For directories in
ready.txt with trailing
\ will be removed before the
Since you are moving the directories from one drive to another you can't use
move. Here is a solution with
if "%dest_folder:~-1%"=="\" set dest_folder=%dest_folder:~0,-1%
for /f "delims=" %%a in (%dir_list%) do (
if "!dir1:~-1!"=="\" set dir1=!dir1:~0,-1!
for %%f in (!dir1!) do set dir2=%%~nxf
robocopy "!dir1!" "%dest_folder%\!dir2!" /MOVE /E
robocopy can only copy and move entire directories and not single files. So your
ready.txt should only consists of directories. Trailing
\ are taken care of and can be mixed.
Robocopy needs the complete directory name for the new directory, that's why we need the
for %%f-line (to get te last directory-part of the source-directory.) So it needs
robocopy c:\sub\meme d:\sub\meme. You can't do
robocopy c:\sub\meme d:\sub.
You can test this batchfile by putting
echo before the
(and before the
move in the previous example).