Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
I have come across many scenarios when Administrators would like to use BITS to move files and folder between source and destination since it will not use whole bandwidth during move operation. One caveat with BITS is it will not create folders and subfolders inside destination directory. I have created small PowerShell script that combines xcopy.exe to create directory structure, and Start-BitsTransfer cmdlet to transfer files using BITS.
Import-Module BitsTransfer
$source = "C:\MyDir"
$dest = "\\Server\Share\MyDir\"
xcopy.exe /T /E $source $dest
Get-ChildItem -Path $source -Directory *.* -Recurse | foreach {$spath = $_.FullName.Remove(0,$source.Length+1); Start-BitsTransfer -Source $source\$spath\*.* -Destination $dest\$spath}
Start-BitsTransfer $source\*.* $dest