Robocopy command in a script

Robocopy command in a script

Robocopy command in a script 150 150 Roderick Derks

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"
 

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message