I recently found myself copying a large cache of files from an external drive to a network drive via my PC. The transfer took 12 hours, and with less than 14 megabytes before it was done, the copy dialog box, along with the entire Windows shell, flickered to black and disappeared.
Unfortunately, the files were stored in a deep and wide folder hierarchy so I couldn’t eyeball it for the missing half dozen files. Here’s how I solved it, with Powershell.
I needed a set of PowerShell commands that could compare an entire hierarchy folders, subfolders (sub-sub-sub folders….), and files and list just the differences.
$Destination = Get-childitem "C:\Path\To\Destination" -Recurse $Source = Get-Childitem "E:\Path\To\Source" -Recurse Compare-Object -ReferenceObject $Destination -DifferenceObject $Source Name Length path SideIndicator ---- ------ ---- ------------- 624484.pdf 0 => 624484.pdf 175346 <= 624485.pdf ...212 <= 624486.pdf 807157 <= 624487.pdf ...765 <= 624488.pdf ...623 <= 624489.pdf 276065 <= 624490.pdf 241006 <= 624491.pdf 393748 <= 624492.pdf 295845 <= 624493.pdf 374639 <= 624494.pdf ...234 <= 624495.pdf ...043 <=
That’s enough information to find and fix the problem. These last files weren’t moved over. I searched for just one file and found the entire directory they’re in.
Note 624484.pdf is listed twice. That’s where the file transfer was botched. The first line indicates it’s on the destination directory and is 0 bytes. The second indicates the source directory version.