ROBOCOPY – altre informazioni utili

Per eseguire ad esempio la copia della cartella PrivateDocs in un percorso diver locale o remoto è possibile utilizzare il seguente comando:

robocopy “SourcePath\PrivateDoc” “DestinationPath\PrivateDoc” /MIR /SEC /SECFIX /R:1 /W:1 /V /TEE /LOG:Copy-PrivateDocs.log

/MIR

Mirrors a directory tree (equivalent to /e plus /purge)
The /mir option is equivalent to the /e plus /purge options with one small difference in behavior:
With the /e plus /purge options, if the destination directory exists, the destination directory security settings are not overwritten.
With the /mir option, if the destination directory exists, the destination directory security settings are overwritten.

/SEC

Copies files with security (equivalent to /copy:DAT)

/SECFIX

Fixes file security on all files, even skipped ones

/R

Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries)

/W

Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds)

/V

Produces verbose output, and shows all skipped files

/TEE

Writes the status output to the console window, as well as to the log file

/LOG

Writes the status output to the log file (appends the output to the existing log file).
Il comando può essere anche eseguito più volte consentendo così di eseguire test o di gestire modifiche alla struttura di un file server con downtime minimi in quanto è possibile eseguire la copia dei file non modificati a ridosso dello spostamento preventivamente.

Per quanto riguarda la gestione dei permessi NTFS con RoboCopy si veda il seguente post

Robocopy /MIR switch – mirroring file permissions

> ROBOCOPY /MIR /SEC /SECFIX

/MIR will replicate data and security (as /SEC is specified) for changed files, and /SECFIX will update just the security for unchanged files. Add /V to the command line if you want to see which files are having their security “fixed” without having their data copied.

Leave Comment