iTunes put a "1" at the end of many of my song and video titles. How can I fix this?

I recently consolidated my iTunes Library and now many videos have a "1" at the end of the file name. And weirdly, in the media library, there are two files - one with the "1" and one without. Luckily only one video appears in iTunes. Is there some way to clean up my media folder AND the filenames in itunes?


I just use a quick and dirty AppleScript to do things like this:`

-- BP Jan 2014
-- Trims a set number of characters from the Start of track names in an iTunes playlist
-- Or trims a set number of characters from the End of track names in a playlist
-- Or adds a prefix to each track name in a playlist.
-- Or adds a suffix to each track name in a playlist.
-- Trims take precedence over adds
-- It's best to do just one operation at a time, and set all the other variables to "" or 0 as appropriate.
--------------------------------- User settable variables
set PlaylistName to "AAA" -- Just add the tracks you want to change to a single playlist. When dione, delete the playlist.
set trimInitialchars to 0 -- nonzero value takes precedence over any addstart value
set trimFinalchars to 0
set addstart to "" -- nonempty value wil overide addend
set addend to ""
--------------------------------- End of user settable variables
set trimstart to trimInitialchars + 1
tell application "iTunes"
    activate
    set tracklst to every track of playlist PlaylistName
    set trackcount to number of items in tracklst
    repeat with n from 1 to trackcount -- Do the whole playlist:
        set oldtitle to name of track named (name of item n of tracklst)
        if trimInitialchars is greater than 0 then -- Trim stuff from front of track names
            set name of (item n of tracklst) to (characters trimstart through length of oldtitle) as text
        else if trimFinalchars is greater than 0 then -- Trim stuff from front of track names
            set name of (item n of tracklst) to (characters 1 through ((length of oldtitle) - trimFinalchars) of oldtitle) as text
        else if addstart is not "" then -- Add something to front of track names
            set name of (item n of tracklst) to (addstart & oldtitle)
        else if addend is not "" then -- Add something to end of track names
            set name of (item n of tracklst) to (oldtitle & addend)
        end if
    end repeat
end tell`

I had a similar issue recently when I moved my media files from my computer's internal hard drive to an external hard drive. The problem occurred when I first manually moved all the folders under USERNAME/Music/ on my computer to a folder on my external drive, opened the Music application on my computer (formerly iTunes) while holding the option key, changed the library to refer to the copied library now in the external drive, and under File > Organize Library..., checking "Consolidate files" and clicking ok. This created the exact same issue where I ended up with duplicates of all the songs in the new copy of the iTunes Media folder with a one (1) at the end of each duplicate file. These duplicates were the ones being referred to by each song in my library, and the originals did not show up when I checked for duplicate songs on the Music Application.

Here is how I got rid of the duplicates using only the Music application on my computer and two different folder locations, the original location and a new location. In my case, the original folder location is on my external drive, where I want my files to be now, and the new one is in a temporary folder on my internal drive, but you can change this to meet your needs.

NOTE: If you use two folders in the same drive, make sure you have enough space on the drive for two copies of your music files.

  1. When in the Music application, go to the Music menu, choose Preferences, and go to the Files tab.
    • Under Music Media folder location, click Change…, then go from the original folder where the music currently resides to the new folder to where the music will be moved (this may be from the external drive’s folder to the internal drive’s folder, or from an internal drive’s folder to another folder in the same drive).
  2. After that process is done, in the Music application, go to the File menu, go to the Library submenu, and choose Organize Library…
    • Check the Consolidate files option, then click OK. This will make copies of the music files to the new media folder without affecting the original files in the original location.
  3. After the copying process is done, check the songs in your Music application library, both those downloaded from Apple Music and those that are yours, and make sure that they are referring to the files in the new location. To do this, right-click the song or click the three horizontal dots that show up when your cursor hovers over the song, choose Get Info, and go to the File tab.
    • Near the bottom of that display, the location value should refer to the new folder instead of the old one.
    • Verify that the songs are not showing duplicates anymore by going to the new folder and seeing any album of songs there.
    • Verify that the songs from different sources are able to play.
  4. NOTE BEFORE DELETING MEDIA: Audiobooks, ringtones, home videos, and other media types will not copy through the Apple Music application anymore. If you want to keep these, do not delete them.
    • In the original folder, you are now able to delete the Music and Apple Music folders.
  5. You now have your library residing in the new folder. If you want to move the music back to the original folder, just repeat steps 1 through 4. Otherwise, you're done!
    1. Change the Music Media folder location back to the original folder.
    2. Go to Organize Library…, choose the Consolidate files options, and click OK.
    3. Check each type of song in your Music application library, check the original folder to make sure that there are no more duplicates, and make sure they can play.
    4. In the new folder, you can safely delete the Music and Apple Music folders.