Created
October 24, 2019 21:18
-
-
Save tylerapplebaum/0520bd4281a2d6c4b0acce72b160b89d to your computer and use it in GitHub Desktop.
Revisions
-
Tyler Applebaum revised this gist
Oct 24, 2019 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ #https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx #http://www.luisrocha.net/2008/12/robocopy-error-error-5-0x00000005.html #Robocopy switches used: #/MIR - mirror directory structure (including empty) #/COPY:DT - excludes copying permissions #/XA:H - excludes hidden files #/W:5 - wait 5 seconds on a failure #/XJD - exclude junction points Function Sync-Documents { param( -
Tyler Applebaum created this gist
Oct 24, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx #http://www.luisrocha.net/2008/12/robocopy-error-error-5-0x00000005.html # Robocopy switches used: # /MIR - mirror directory structure (including empty) # /COPY:DT - excludes copying permissions # /XA:H - excludes hidden files # /W:5 - wait 5 seconds on a failure # /XJD - exclude junction points Function Sync-Documents { param( [Parameter(HelpMessage="Specify the source path to data you wish to copy",Mandatory=$True)] [ValidateScript({Test-Path $_ -PathType Container})] [string]$SourceDir, [Parameter(HelpMessage="Specify the destination path of data to be copied to",Mandatory=$True)] [System.IO.FileInfo]$DestDir ) robocopy.exe $SourceDir $DestDir /MIR /COPY:DT /XA:H /W:5 /XJD } Sync-Documents -SourceDir "C:\Users\$env:username\Documents" -DestDir "W:\My Documents\Documents-Backup"