Last active
August 29, 2015 14:06
-
-
Save lantrix/b3916a3a91ff95e887d4 to your computer and use it in GitHub Desktop.
robocopy in powershell
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 characters
#Path of git:master repo synced onto web console | |
$sqlSourcePath = "C:\Source Folder" #with trailing backslash | |
$sqlDestinationDrive = "C" #raw drive letter only | |
$sqlDestinationPath = "SQL_commands" # without trailing backslash or drive e.g.: path\to\copy\folder | |
$RobocopySyntax = ' /COPY:DAT /R:0 /W:0 /MIR' | |
$a = [char]34 | |
$Source = $sqlSourcePath | |
$Destination = '\\' + $destinationIP + '\' + $sqlDestinationDrive + '$' + '\' + $sqlDestinationPath + '\' | |
$Robocopy = 'robocopy ' + $a + $Source + $a + ' ' + $a + $Destination + $a + $RobocopySyntax | |
invoke-expression $Robocopy | |
$Robocopy | |
Get-Process robocopy | Foreach-Object { $_.WaitForExit() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment