$user = $env:username
$path = read-host -Prompt 'Set source path'
$dest = read-host -Prompt 'Set destination path'
write-host "Your source path is $path"
write-host
write-host "Your destination path is $dest"
start-sleep -s 5
$files = Get-ChildItem $path -recurse
\[System.Reflection.Assembly\]::LoadWithPartialName("System.Windows.Forms") | out-null;
$counter = 1
Foreach($file in $files)
{
$status = "Copy files {0} on {1}: {2}" -f $counter,$files.Count,$file.Name
Write-Progress -Activity "Copy data" $status -PercentComplete ($counter / $files.count\*100)
$restpath = $file.fullname.replace($path,"")
Copy-Item $file.fullname $($dest+$restpath) -Force
$counter++
}
If ($Counter = $files.Count)
{\[System.Windows.Forms.MessageBox\]::Show("Backup End.")
}