קוד:
# Copy a large Folder to Destination including itself
$Source = "$Env:UserProfile\Documents\New folder1"
$Destination = "$Env:UserProfile\Documents\New folder2"
$Name = Split-Path -Path $Source -Leaf
# Copy folders
GCI -Path $Source -Recurse -Directory | % {
$NewFolder = $_.FullName.Replace( $Source, "$Destination\$Name")
New-Item -ItemType Directory -Path $NewFolder -Force | Out-Null
}
# Start-BitsTransfer for each and each file
GCI -Path $Source -Recurse -File | % {
$Params = @{
Source = $_.FullName
DisplayName = "$Env:UserName"
Destination = $_.FullName.Replace( $Source, "$Destination\$Name" )
TransferType = "Download"
Asynchronous = $True
Priority = "Low"
}
Start-BitsTransfer @Params -Verbose
}
#
#
# When you want to Resume copying after any pause
Get-BitsTransfer -Name "$Env:UserName*" | Resume-BitsTransfer -Verbose -EA:0 | Complete-BitsTransfer -Verbose -EA:0
# If you wanna suspend and remove all your copying ( yours alone )
Get-BitsTransfer -Name "$Env:UserName*" | Suspend-BitsTransfer -Verbose -EA:0 | Remove-BitsTransfer -Verbose -EA:0
נערך לאחרונה ב: