Want to free up some space, don't want to delete non-duplicates.
January 9, 2011 3:58 PM Subscribe
Two folders with almost identical contents. How to either delete duplicates or move not-duplicates. On OS X, happy to use terminal.
I have two folders (my current and previous iTunes library, so lots of nested folders etc.).
I would like to compare $oldfolder with $currentfolder, and either:
1. delete all duplicates in $oldfolder; or
2. move all non-duplicates from $oldfolder into a separate location
If option 1. is taken, I would like any empty directories to be removed.
If option 2. is taken, I'm not fussed as to whether the AAC/MP3 files are moved and just dumped in a new folder, or whether the file structure is maintained.
The contents of $oldfolder aren't indexed by my iTunes library (that's only $currentfolder), so this isn't a case of duplicates in my iTunes library, just a case of duplicate files on my system.
I'm happy to use the terminal for this, but doing this from scratch is a little beyond my competence.
Thanks for your help!
posted by djgh to computers & internet (12 answers total) 10 users marked this as a favorite
rsync. You can ask it to sync your $currentfolder from $oldfolder, omitting the--deleteoption so as not to remove anything from your $currentfolder (and perhaps even specifying-n -vwhich should tell you what it WOULD do without modifying anything).I'm not terribly familiar with OS X but
rsyncis a fairly standard unix tool. Tryman rsyncin terminal for a summary of its usage.posted by axiom at 4:26 PM on January 9, 2011