first completed scripts for backup + copy2external hd

This commit is contained in:
2021-11-06 14:10:21 +01:00
parent ec22def282
commit d14f7aa944
2 changed files with 7 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ $SourcePath = "E:\Backup"
$BackupPath = "G:\Backup\GigabyteWinServer" $BackupPath = "G:\Backup\GigabyteWinServer"
function Copy-Dir($Source,$Destination){ function Copy-Dir($Source,$Destination){
$n = New-Item -ItemType Directory -Force -Path $Destination
Write-Host("Copy Folder: $Source to Folder: $Destination") Write-Host("Copy Folder: $Source to Folder: $Destination")
$files = Get-ChildItem $Source -Recurse $files = Get-ChildItem $Source -Recurse
foreach ($f in $files){ foreach ($f in $files){
@@ -12,9 +12,9 @@ function Copy-Dir($Source,$Destination){
$n = New-Item -ItemType Directory -Force -Path $dest $n = New-Item -ItemType Directory -Force -Path $dest
} else { } else {
if ($f.Length -gt 10000000){ if ($f.Length -gt 10000000){
#Start-BitsTransfer -Source $f.FullName -Destination $dest Start-BitsTransfer -Source $f.FullName -Destination $dest
} else { } 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 $Destination = $BackupPath+"\"+$f
Write-Host(" Source-Path: $Source") Write-Host(" Source-Path: $Source")
Write-Host(" Target-Path: $Destination") Write-Host(" Target-Path: $Destination")
Copy-Dir -Source $SourcePath -Destination $Destination Copy-Dir -Source $Source -Destination $Destination
if ($move){ if ($move){
Remove-Item -Recurse -Force $Source Remove-Item -Recurse -Force $Source
} }

View File

@@ -87,7 +87,7 @@ function startDocker(){
} }
function copyDir($Source,$Destination){ function copyDir($Source,$Destination){
$n = New-Item -ItemType Directory -Force -Path $Destination
Write-Host("Copy Folder: $Source to Folder: $Destination") Write-Host("Copy Folder: $Source to Folder: $Destination")
$files = Get-ChildItem $Source -Recurse $files = Get-ChildItem $Source -Recurse
foreach ($f in $files){ foreach ($f in $files){
@@ -96,9 +96,9 @@ function copyDir($Source,$Destination){
$n = New-Item -ItemType Directory -Force -Path $dest $n = New-Item -ItemType Directory -Force -Path $dest
} else { } else {
if ($f.Length -gt 10000000){ if ($f.Length -gt 10000000){
#Start-BitsTransfer -Source $f.FullName -Destination $dest Start-BitsTransfer -Source $f.FullName -Destination $dest
} else { } else {
#Copy-Item -Path $f.FullName -Destination $dest Copy-Item -Path $f.FullName -Destination $dest
} }
} }
} }