Terminal command to move a number of files containing brackets to another folder or trash 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.
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'