Robocopy command in a script PDF Print E-mail
Wednesday, 28 July 2010 12:58

Just a few notes for myself here today. about the robocopy command:

Command that makes sure all rights are preserved and changed/new data is monitored and copied every 10 minutes:

robocopy "\\source_servername\d$" "\\destination_servername\d$" /COPYALL /E /V /NP /ETA /XO /MON:10 /MOT:5 /LOG:logfile.txt

another command I used once, forgot what is special about this one:

robocopy "M:" "H:\Music_Please" /MIR

---------------------------

@echo off

rem +---- Verwijder oude logfile
    if exist "%0.log" del "%0.log"

echo. >> "%0.log"
echo +--- VERWIJDER DRIVE-MAPPINGS >> "%0.log"

if exist J:\. net use J: /del
if exist K:\. net use K: /del

echo. >> "%0.log"
echo +--- ZET NOODZAKELIJKE DRIVE-MAPPINGS >> "%0.log"

net use J: \\10.110.4.107\c$ /user:wscapture1\review1 review1
net use K: \\10.110.4.107\e$ /user:wscapture1\review1 review1

echo. >> "%0.log"
echo +--- Zet SOURCE en DESTINATION >> "%0.log"

   set source=K:\_WS-Data
   set dest=G:\Dfag\_WS-Data
   set files=*.*
   set copy_flags=/r:1 /w:1 /move /e /v /np /log+:"%0.log"

   set exclude_dirs=/XD
   set exclude_dirs=%exclude_dirs% "noppes"

   robocopy "%source%" "%dest%" "%files%" %exclude_dirs% %copy_flags%

echo. >> "%0.log"
echo +--- VERWIJDER DRIVE-MAPPINGS >> "%0.log"

if exist J:\. net use J: /del
if exist K:\. net use K: /del

echo +------------------------------------------------- >> "%0.log"

echo +--- Einde! >> "%0.log"
 

 

Add comment


Security code
Refresh

More KB Articles