first completed scripts for backup + copy2external hd
This commit is contained in:
@@ -3,7 +3,7 @@ $SourcePath = "E:\Backup"
|
||||
$BackupPath = "G:\Backup\GigabyteWinServer"
|
||||
|
||||
function Copy-Dir($Source,$Destination){
|
||||
|
||||
$n = New-Item -ItemType Directory -Force -Path $Destination
|
||||
Write-Host("Copy Folder: $Source to Folder: $Destination")
|
||||
$files = Get-ChildItem $Source -Recurse
|
||||
foreach ($f in $files){
|
||||
@@ -12,9 +12,9 @@ function Copy-Dir($Source,$Destination){
|
||||
$n = New-Item -ItemType Directory -Force -Path $dest
|
||||
} else {
|
||||
if ($f.Length -gt 10000000){
|
||||
#Start-BitsTransfer -Source $f.FullName -Destination $dest
|
||||
Start-BitsTransfer -Source $f.FullName -Destination $dest
|
||||
} else {
|
||||
#Copy-Item -Path $f.FullName -Destination $dest
|
||||
Copy-Item -Path $f.FullName -Destination $dest
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ function Backup-Data($SourcePath,$BackupPath){
|
||||
$Destination = $BackupPath+"\"+$f
|
||||
Write-Host(" Source-Path: $Source")
|
||||
Write-Host(" Target-Path: $Destination")
|
||||
Copy-Dir -Source $SourcePath -Destination $Destination
|
||||
Copy-Dir -Source $Source -Destination $Destination
|
||||
if ($move){
|
||||
Remove-Item -Recurse -Force $Source
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user