Robocopy

https://technet.microsoft.com/en-us/library/cc733145.aspx

http://pastebin.com/E1iiUsF7

http://robomirror.sourceforge.net/ shadow copy issue. Copying extended NTFS owner and auditing information /copyall or /copy:datsou

http://www.sevenforums.com/tutorials/187346-robocopy-create-backup-script.html

http://stackoverflow.com/questions/6649527/rsync-does-not-properly-set-permissions-on-windows-folder?rq=1

http://stackoverflow.com/questions/5798807/rsync-on-windows-wrong-permissions-for-created-directoried

https://michael.mckinnon.id.au/2011/06/27/how-to-do-windows-backups-with-robocopy-tips/ Junction points.

code notes

 * /DCOPY:T directory time stamps. http://burpee.smccme.edu/studenthowtos/robocopy.htm, http://ss64.com/nt/robocopy.html  What to COPY (default is /COPY:DAT) (copyflags : D=Data, A=Attributes, T=Timestamps  S=Security=NTFS ACLs, O=Owner info, U=aUditing info). /SEC : Copy files with SECurity (equivalent to /COPY:DATS).  /DCOPY:T : Copy Directory Timestamps. /COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU)./NOCOPY : Copy NO file info (useful with /PURGE).
 * /mir -> /E /PURGE and will clobber all files in destination directory that don't match source. Preserve existing files in target directory by with only the /E flag. It means to copy all including empty directories.
 * /COPYALL, copy all file info and maintain file permissions and shares.
 * /TBD, wait for sharenames to be defined.
 * /V verbose shows process but slows it down. /NP no progress, speeds up copying. /ETA estimated time of arrival of file.
 * /L only list files, don't copy anything. /TEE output to console window and log file.
 * set EXCLUDES=/xd *RECYCLE* "System Volume Information" /xf .DS_Store Thumbs.db *.$$$ desktop.ini *.sys
 * robocopy.exe C:\Data1 e:\Backups\Data1 %ARGS% %EXCLUDES% %LOGTEST% 
 * /Z /xd /XJ /XF michael mckinnon win backup
 * /XJ – Exclude NTFS junction points, to avoid the endless “Application Data” folder nesting on some Windows Vista/7 machines.
 * It has a nifty network-restartable mode (/Z option) which means if it fails, you can just re-run the command and it will pick up where it left off essential when you’re moving Gigabytes and Terra-bytes of data
 * set ARGSNOFILEDEL = /E /COPYALL /ETA /r:1 /w:1 /TEE
 * robocopy.exe C:\Data1 e:\Backups\Data1 %ARGSNOFILEDEL% %LOGTEST% 
 * /B backup mode prevents access denied errors. /IPG bandwidth to use over network. xpertnotes.net robocopy
 * xo switch /XO copies if source date > target date.  ONly copies if source file is the latest file, instead of if they differ in any way.  /XN will copy if source date < target date  or target date > source date. Copies if source file is older than target file. This is rarely used.
 * I came across a command line switch for Robocopy: /FFT : Assume FAT File Times (2-second date/time granularity). So what this does is force Robocopy to use FAT style time stamps which are 2-second granularity.  It allows enough flexibility to account for the way the time is recorded when doing a file copy from NTFS to another file system. This is needed when going between and NTFS and Linux/Unix/FAT or emulated file system. NTFS to FAT copying Now, since I backup weekly and only ever add files, I usually first do a run with /XO (or /XN, according to the season) to synchronize new and weaked files (together with the odd extra one), then a second pass with /COPY:T to synchronize timestamps. http://arstechnica.com/civis/viewtopic.php?t=104774

3
http://robomirror.sourceforge.net/  Volume shadow copy to copy files locked by running processes    Robocopy backup mode /zb or /b to copy files the user has no direct access to   Copying extended NTFS owner and auditing information /copyall or /copy:datsou In order to use these features, the user needs to be in the Backup Operators or in the Administrators group. In the latter case, Robomirror needs to be run as administrator if using Windows Vista or newer and UAC is enabled.

http://ithelp.cveg.uark.edu/IT_Help/Documents_files/backup.pdf  vshadod.exe command

Final script
@echo on set LOGTEST=/log:c:\Games\backuplog.txt set LOG=/log:c:\Games\backdownload.txt set ARGS= /E /Z /B /NP /XO /XJ /FFT /J /XA:H /COPY:DATS /PURGE /r:0 /w:0 set EXCLUDEDIRECTORY=/Xd "Temporary Internet Files" *RECYCLE* "System Volume Information" Set EXCLUDEFILES=/XF pagefile.sys hiberfil.sys robocopy.exe  C:\Users\pc2\Documents    e:\Backups\Data1     %ARGS%   %EXCLUDEDIRECTORY%  %EXCLUDEFILES%  %LOGTEST% robocopy.exe  C:\Users\pc2\Downloads    e:\Backups\Downloads %ARGS%   %EXCLUDEDIRECTORY%  %EXCLUDEFILES%  %LOGTEST% pause

PURGE
careful with the /PURGE option, remove it on the first copy. make certain that you create a folder to copy the folders to.

Links

 * https://scoop.sh/, https://github.com/lukesampson/pshazz win10 install script automation on top of powershell
 * rsync
 * http://ss64.com/nt/robocopy.html /J copy large files in unbuffered mode.
 * http://caughtinpixels.com/how-to-create-a-backup-script-using-robocopy/ /XA:H don't copy hidden files, they are probably not data files.
 * LinuxNotes