robocopy xcopy copy
robocopy multiple files at once : robocopy source_folder destination_folder file_name_1 file_name_2 file_name_3
robocopy silent :
ROBOCOPY
[source] [target] /NFL /NDL /NJH /NJS /nc /ns /np
/NFL : No File List - don't log file names.
/NDL : No Directory List - don't log directory names.
/NJH : No Job Header.
/NJS : No Job Summary.
/NP : No Progress - don't display percentage copied.
/NS : No Size - don't log file sizes.
/NC : No Class - don't log file classes.
From:
http://stackoverflow.com/a/922976/4213218
Using robocopy in Visual Studio's Post-Build Event:
You may encounter the error MSB3073: robocopy exit with code 1.
Visual Studio thinks that only code 0 means success. But robocopy returns a value greater than 7 when it failed.
We need to map the exit code:
robocopy "$(TargetDir)." destination_folder "$(TargetFileName)" /NDL /NJH /NJS /nc /ns /np
if %ERRORLEVEL% EQU 16 echo ***FATAL ERROR*** & goto end
if %ERRORLEVEL% EQU 15 echo OKCOPY + FAIL + MISMATCHES + XTRA & goto end
if %ERRORLEVEL% EQU 14 echo FAIL + MISMATCHES + XTRA & goto end
if %ERRORLEVEL% EQU 13 echo OKCOPY + FAIL + MISMATCHES & goto end
if %ERRORLEVEL% EQU 12 echo FAIL + MISMATCHES& goto end
if %ERRORLEVEL% EQU 11 echo OKCOPY + FAIL + XTRA & goto end
if %ERRORLEVEL% EQU 10 echo FAIL + XTRA & goto end
if %ERRORLEVEL% EQU 9 echo OKCOPY + FAIL & goto end
if %ERRORLEVEL% EQU 8 echo FAIL & goto end
if %ERRORLEVEL% EQU 7 echo OKCOPY + MISMATCHES + XTRA & goto end
if %ERRORLEVEL% EQU 6 echo MISMATCHES + XTRA & goto end
if %ERRORLEVEL% EQU 5 echo OKCOPY + MISMATCHES & goto end
if %ERRORLEVEL% EQU 4 echo MISMATCHES & goto end
if %ERRORLEVEL% EQU 3 echo OKCOPY + XTRA & goto end
if %ERRORLEVEL% EQU 2 echo XTRA & goto end
if %ERRORLEVEL% EQU 1 echo OKCOPY & goto end
if %ERRORLEVEL% EQU 0 echo No Change & goto end
:end
if %ERRORLEVEL% GTR 7 (exit %ERRORLEVEL%) else (exit 0)
I tested it and it was succussful.
P.S.
If either the source or desination are a "quoted long foldername", do
not include a trailing backslash ! Because this will be treated as an escape character,
i.e. "C:\some path\" will fail but "C:\some
path\\" or "C:\some path\." or "C:\some
path"will work.
From: