I have recently rewrote my function to restore backup from "MyBackupFolder" using Start-BitsTransfer, because it shows a progress bar and I would like to have it.
However, I noticed it does not copy nested folders and files recursively, like my former function did (meaning it will not copy my folders and subfolders with files within them at all).
1.) Is there a way to use Start-BitsTransfer recursively so it would do that? 2.) IF not, is there a way to use Copy-Item with loading bar?
This is an example of the aforementioned folder structure:
c:\Users\username\AppData\Local\MyBackupFolder\Folder1\Subfolder1\user.config
c:\Users\username\AppData\Local\MyBackupFolder\Folder2\file.xml
c:\Users\username\AppData\Local\MyBackupFolder\Folder3\Subfolder2\severalFiles
This is how the function formerly looked like:
function Restore-From-Backup($Source, $Destination) {
Copy-Item -Path $Source -Destination $Destination -Recurse
}
This is how it looks now:
function Restore-From-Backup($Source, $Destination) {
Start-BitsTransfer -Source $Source -Destination $Destination -TransferType Download
}
Problem solved now, as Powershell 7.4.5 has a progress bar by default when copying files.