(view source code of robomove.bat as plain text)
:: Check Windows version
:: Enable delayed variable expansion
:: Check command line arguments
:: Initialize variables
:: Save the current title if possible
:: Navigate to the first folder, giving it a drive letter on the fly in case of a UNC type path
:: Navigate to the second folder, giving it a drive letter on the fly in case of a UNC type path
:: Navigate to the TEMP folder
:: Create 2 lists of files to be uodated
XCOPY %Files1% %Files2% /S /D /H /R /Y /L | FIND "\" > %Temp1%
XCOPY %Files2% %Files1% /S /D /H /R /Y /L | FIND "\" > %Temp2%
:: Replicate the directory structure of source on target
XCOPY %Files1% %Files2% /T /E /Y >NUL 2>&1
:: Count the number of files moved and directories created
:: For each file in the first list ...
REM :: ... check for duplicates on either drive
REM :: If no duplicates were found ...
REM ... find the location of the file to be moved ...
REM :: ... move the file to its new location
MOVE "%%~fB" "%%~dB%%~pA"
SET /A FilesMoved += 1
) ELSE (
ECHO Moved 1 file.
TITLE Moved 1 file.
) ELSE (
ECHO Moved %FilesMoved% files.
TITLE Moved %FilesMoved% files.
:: Run ROBOCOPY if specified
IF /I "%~3"=="/ROBOCOPY" (
SET /A Counter += 1
SET Options=!Options! %%A
ROBOCOPY "%~f1" "%~f2" /MIR !Options!
ECHO RoboMove.bat, Version 0.30 beta
ECHO Usage: ROBOMOVE source_folder target_folder
ECHO ROBOCOPY source_folder target_folder /MIR [ robocopy_options ]
ECHO or: ROBOMOVE source_folder target_folder /ROBOCOPY [ robocopy_options ]
ECHO target_folder the target folder, where the files will be moved to
ECHO match the source folder as closely as possible
ECHO /ROBOCOPY run ROBOCOPY /MIR on the specified folders afterwards
ECHO robocopy_options are the switches passed on to ROBOCOPY
ECHO Written by Rob van der Woude
|page last uploaded: 2017-07-06, 12:37|