1

Last night I consolidated a music collection into one place and each song is separated by an Artist folder and the track. The problem is that there are a high number of duplicates within these folders. There are over 3,000 artist folders and in each artist folder there are a couple of duplicates, so I wouldn't like to guess how many duplicates there are in total.

The software I used to consolidate the music has taken each duplicate track and renamed the subsequent file with an (1).mp3, or if it has more than one duplicate, it has been renamed (2).mp3, (3).mp3 and so on until it renames the last number of duplicates found for that particular track.

So i felt the best way to delete these was to do a simple "(1).mp3" search in spotlight but for some reason it does not give me the right results no matter what I try. (I read somewhere it has something to do with how linux/mac os is setup). So I then looked into using terminal to search the directory using the appropriate command. But this does not seem to work either. The path of the directory is:

/Volumes/AUDIO\ DRIVE/Music\ Database

So I used the command…

find /Volumes/AUDIO\ DRIVE/Music\ Database “(1).mp3"

…which does return results, but not in the way I expected, i.e. it returns many files, only some of which have the (1).mp3 at the end of them. Most of them don't have this and are just normal tracks with .mp3 at the end. e.g. The Beatles - Ticket to Ride.mp3

So I then looked into a command that would allow me to search for these files and move the results into another location. So I created a folder called "Moved Files" which has a directory of:

/Volumes/AUDIO\ DRIVE/Moved\ Files

So I used the following command I found online...

find /Volumes/AUDIO\ DRIVE/Music\ Database “(1).mp3" -exec mv {} ~/Volumes/AUDIO\ DRIVE/Moved\ Files \;

…which does one of two things depending on what humour Terminal is in. It either moves the wrong files to the specified directory (maybe due to the inaccurate search results I had at the beginning) or it gives me the following error:

-bash: syntax error near unexpected token `)'

If anyone out there can help me I would really appreciate it. It's really frustrating to know that if this was a windows machine, all I would need to do is type *(1).mp3 in the search bar and block delete all of the results, but I honestly cannot find a way around this on a mac. And "NO" I cannot use a windows machine as it is an apple G Drive that has all the audio stored on it.

2

find expects a pattern not just a name, so you might get better results with

find /Volumes/AUDIO\ DRIVE/Music\ Database -name '*(1).mp3' -print
1

Simply use Spotlight in Finder to search for files with *(1).mp3 etc. Begin a new Spotlight search, add a Raw Query rule and use the following, then select all and delete.

kMDItemDisplayName=='*(1).mp3'
  • Thanks for your reply but this does not seem to work, it only returns four results. I thought it may have to do with the fact that the drive is external that i created the raw query with so I moved the music database locally and reindexed the files but to no avail. Any other ideas? – Chris Cleary Oct 22 '14 at 0:10
0

Seems that the error in you terminal command is due to a bad cut and paste. Replace the first “ with " , so that the final command is the following:

find /Volumes/AUDIO\ DRIVE/Music\ Database -name "*(1).mp3" -exec mv {} ~/Volumes/AUDIO\ DRIVE/Moved\ Files \;

If you are confident with the terminal I suggest to install fdupes or the fork fdupes-jody and then:

fdupes -r dir1 dir2 | grep dir1/ | xargs rm 

to removes duplicates in dir1.

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .