Find and copy photos from old disk using PowerShell

My mom has been lugging around an old, non-booting Toshiba consumer laptop because the hard drive has photos on it she doesn’t want to lose. I finally decided to work on getting the photos off of it today.

$SourceDir = "D:\Users\dir"
$DestinationDir = "F:\"
Get-ChildItem -Path "$SourceDir" -Filter *.jpg -File -Recurse | Copy-Item -Destination "$DestinationDir"

That probably isn’t the best way. It probably would have been better and faster to use something like:

Get-ChildItem -Path "$SourceDir" -recurse | where {$_.extension -in ".jpg",".png"} | Copy-Item -Destination "$DestinationDir"