I\'m interested in a PowerShell script that copies a large amount of files from a server daily and I\'m interested in implementing a in-console progress bar like
This is the code-snippet I finally used for such task:
$fileName = 'test.txt'
$fromDir = 'c:\'
$toDir = 'd:\'
$title = $null
&robocopy "$fromDir" "$toDir" "$fileName" /z /mt /move /w:3 /r:10 /xo | %{
$data = $_.Split("`t")
if ($title -and $data[0] -match '\d+(?=%)') {
Write-Progress $title -Status $data -PercentComplete $matches[0]
}
if($data[4]) {$title = $data[4]}
}
Write-Progress $title -complete