spazlepoof
New Member
I found a Windows batch script on a website but would like to learn how to do it on Linux. Can anyone please help?
SOURCE: https://superuser.com/questions/508613/program-to-swap-files-between-drives
The simplest way is writing a small script (batch file) would be sufficient.
Assuming you have 1.5Tb on one of the drives, identify three blocks of 1.5Tb on each drive and write a batch file that will do the job.
You may also semi-automate this process. Assuming you are on Windows, want to copy drives X:and Y:, and each file is smaller than your free space (1.5Tb).
Robocopy which is a part of Windows 2003 resource kit tools
--- start script ---
: repeat
robocopy X:\ Y:\From_X /MOVE /XD From_Y
if errorlevel 2 GOTO cont
SET FIRST_OK=1
: cont
robocopy Y:\ X:\From_Y /MOVE /XD From_X
if errorlevel 2 GOTO repeat
IF "%FIRST_OK"="1" GOTO end
GOTO repeat
: end
move X:\From_Y X:\
move Y:\From_X Y:\
--- end script ---
See this link for errorlevel's returned by robocopy. 2 or higher means yet not done.
shareimprove this answer
edited Nov 22 '12 at 9:56
answered Nov 21 '12 at 13:44

bytebuster
5691921
add a comment
SOURCE: https://superuser.com/questions/508613/program-to-swap-files-between-drives
The simplest way is writing a small script (batch file) would be sufficient.
Assuming you have 1.5Tb on one of the drives, identify three blocks of 1.5Tb on each drive and write a batch file that will do the job.
You may also semi-automate this process. Assuming you are on Windows, want to copy drives X:and Y:, and each file is smaller than your free space (1.5Tb).
Robocopy which is a part of Windows 2003 resource kit tools
--- start script ---
: repeat
robocopy X:\ Y:\From_X /MOVE /XD From_Y
if errorlevel 2 GOTO cont
SET FIRST_OK=1
: cont
robocopy Y:\ X:\From_Y /MOVE /XD From_X
if errorlevel 2 GOTO repeat
IF "%FIRST_OK"="1" GOTO end
GOTO repeat
: end
move X:\From_Y X:\
move Y:\From_X Y:\
--- end script ---
See this link for errorlevel's returned by robocopy. 2 or higher means yet not done.
shareimprove this answer
edited Nov 22 '12 at 9:56
answered Nov 21 '12 at 13:44

bytebuster
5691921
add a comment