Robocopy is an often forgotten about tool that is absolutely awesome and runs wonderfully when called from a PowerShell script.
Get-ChildItem and Copy-Item always seem to have too much flexibility built into them so that I see lots of scripts that work correctly accidentally, most often failing when trying to extend beyond copying a single folder’s worth of files. Where should the wildcard go, in the path? in the filter? in the include?
Robocopy is installed on all modern windows OSes and has retry, recursive copy etc. built in. So rather than fiddle with intricacies of Copy-Item, you can be done with the script and have it fun faster by using Robocopy.
& Robocopy.exe $SourceFolder $DestinationFolder *.* /s | Out-Null