А АWednesday, 2 December 2015

ROBOCOPY - robust file copy for Windows.

Hello everybody.

Do you know the utlity ROBOCOPY? Oh, it's a Robust File Copy for Windows! It's cool file utility. I know that you can use any file synchronization tool online, so like as DropBox, Google Drive, and others.


But for my two flash-drives I'm using ROBOCOPY. This is simple utility with many options. So I can configure my synchronization for layout "home2work" very easy. This utility don't require installation!

This is example command line for my Projects folder on my work PC:
robocopy e:\MyProjects\sites! g:\sites *.* /MIR /Z /R:5 /W:10 /NP /LOG:sites.log
robocopy e:\MyProjects\sites! h:\sites *.* /MIR /Z /R:5 /W:10 /NP /LOG+:sites.log

This is example command line for my Documents folder:
robocopy e:\MyDocuments\xls g:\xls *.* /MIR /Z /R:5 /W:10 /NP /LOG+:docs.log
robocopy e:\MyDocuments\xls h:\xls *.* /MIR /Z /R:5 /W:10 /NP /LOG+:docs.log

The second string is for case if the flash-drive mapped by another drive letter. As you understand at home I use similar command line where destination and source folders are viceversa.

If you would like to obtain the GUI for configuration options you can use  latest release of Robocopy.exe which installed with Robocopy GUI 3.1.1.

What will you obtain in this?

By commands:

1. Path Tab.
This is where you will specify the source and target path’s which you would like to have copied.  If you don’t know the exact path, you can click on the browse button at the end of the path box (see Figure).  This will bring up a folder browser dialog box which will allow you to click on the folder that you would like to copy or copied to.   


If your target path is a remote server, you can click on the Map Drive checkbox and specify the path. If you specify a remote path, all you need to specify is the drive letter and folder path, you don’t need to specify the server name.  The server is specified under the “Drive Mapping” tab.  NOTE: Be sure to specify the drive mapping options on the “Drive Mapping” tab.

2. Copy Options.
The Copy Options  tab is where you can specify the behavior you would like robocopy.exe to take. This guide will not cover what each option or combination of options will cause the robocopy.exe to do.  We provide a copy of the Robocopy Users Guide with the installation of the Microsoft Robocopy GUI.  Alternatively, you can hover your mouse over each option and after a brief pause, a description of what the option will do will appear.  (see Figure)


For more details about each option, see the Robocopy.exe Users Guide (Click on Help > Robocopy Users Guide).  

3. Drive Mapping.
If you have specified  on the “Path” tab that you would like to map a network drive, this tab is where you will specify the target server name, user name, password and domain.  If your target server is not a part of a domain, you will need to specify the server name  in this field.  (see Figure)


4. Filters.
The Filters tab is where you can specify more advanced behaviors you would like robocopy.exe to take.  This guide will not cover what each option or combination of options will cause the robocopy.exe to do.  We provide a copy of the Robocopy Users Guide with the installation of the Microsoft Robocopy GUI.  Alternatively, you can hover your mouse over each option and after a brief pause, a description of what the option will do will appear.  (see Figure)


For more details about each option, see the Robocopy.exe Users Guide (Click on Help > Robocopy Users Guide).  

5. Logging.
The Logging section is used to specify logging behavior that robocopy.exe will take when the script is ran.  (see Figure)

For more details about each option, see the Robocopy.exe Users Guide (Click on Help > Robocopy Users Guide). 

6. Monitoring Options.
If you would like to take advantage of some of the new options presented in the latest version of Robocopy.exe, this section will allow you to set monitoring and “near real-time” options.  (see Figure )


6 comments:

Anonymous said...

The main key in your script is */MIR*, isn't it?

Anonymous said...

Да, MIR - создать зеркало всего дерева увзанной папки.

Евген said...

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

Eugene said...

Вот GUI рождает, к примеру, такой вот cmd-файл:

net use \\localhost\ipc$ /user:mydomain\admin admin
robocopy "C:\Users\Pypkin\Desktop\Card" "C:\Users\Pypkin\Desktop\Riga" /MIR /NOCOPY /V /XO /NP /LOG:"myslog.log" /FAT /XL /R:10 /W:30
net use \\localhost\ipc$ /del

Guru Squad said...

We found your blog about Robocopy was much handy to me! If u keep up the good job I’ll come back at your website. Finally I have found something which helped me. Appreciate it!

Anonymous said...

Лучше соблюдать последовательность ключей. Ориентир - смотрите в свой лог на строку Options: *.* /TEE /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /Z /NP /R:2 /W:2

Post a Comment

А что вы думаете по этому поводу?

Версия на печать

Популярное