Created
December 1, 2017 20:24
-
-
Save joegasper/7390950f39bffb8d08946282c8a1c2d3 to your computer and use it in GitHub Desktop.
Run Robocopy with PowerShell
This file contains 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 characters
$site = 'mysite01' | |
$source = "\\my-web1\e$\websites\$site\" | |
$destination = "E:\websites\$site\" | |
#List only first | |
$logfile = "E:\$site-robo-test.txt" | |
$switches = "/E /L /R:2 /W:3 /NP /FFT /DST /LOG:$logfile /XF "".DS_Store"" ""thumbs.db""" | |
& robocopy.exe $source $destination $switches.Split(' ') | |
#Check Log File | |
Get-Content -Path $logfile -First 17 | |
Get-Content -Path $logfile -Tail 10 | |
#Run for real | |
$logfile = "E:\$site-robo.txt" | |
$switches = "/E /R:2 /W:3 /NP /FFT /DST /LOG:$logfile /XF "".DS_Store"" ""thumbs.db""" | |
& robocopy.exe $source $destination $switches.Split(' ') | |
#Check Log File | |
Get-Content -Path $logfile -First 17 | |
Get-Content -Path $logfile -Tail 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment