Is there a way to remove files from a folder that are in another folder?
There's free software out there called WinMerge. You can use this software to match up duplicates. First, use File
→ Open
, and choose both directories, with the folder with files you want to keep on the left, and those you do not on the right. Then, go to View
, and deselect Show Different Items
, Show Left Unique Items
, and Show Right Unique Items
. This will leave just the identical files left in the list. After that, choose Edit
→ Select All
, right-click on any file, and click on Delete
→ Right
. This will delete the duplicates from the right-hand folder.
This can be done through the commandline by using the command forfiles
Lets assume you have Folder A located in c:\temp\Folder A
, and Folder B located in c:\temp\Folder B
The command would then be:
c:\>forfiles /p "c:\temp\Folder A" /c "cmd /c del c:\temp\Folder B\@file"
After this is done, Folder B will have all files removed that are present in Folder A. Keep in mind, that if folder B has files with the same name, but not the same content, they will still be deleted.
It is possible to extend this to work with folders in subfolders too, but out of fear for this to become unnecessary complicated, I've decided against posting it. It would require the /s and @relpath options (and further testing xD)