automatically delete files that exist in another folder
Thu, Aug 16, 2018
1-minute read
Instead of removing items from one Google Photos gallery I decided to add them to another folder – dang, a 190 picture selection lost.
As I needed to download the images anyway, I got the idea: just download both albums and throw in a little PowerShell – to “re-do” the removal of the unwanted images for me!
$filesToRemove = (gci .\folderB\).Name
gci .\folderA\ | % { if ($filesToRemove -contains $_) { Remove-Item $_.FullName } else { echo “nope” }}
And done!
Writing this picece of PowerShell plus this blogpost took less than 5 minutes – about half the time it’d need me to re-select and remove the images manually – thanks PowerShell!