How do I clean up Music app file structure and duplicate files and playlists?

I'm trying to fix a number of problems with my music files in the Music app. I do not have an Apple Music subscription.


I keep my music files on an external drive that I connect to my laptop for downloading digital files or from purchased CDs. The files on this drive represent all the music I want in my digital music library.


A while back, the Music app duplicated many of my playlists as many as 10 or more times. Sometimes, these playlists recognized where the song files were located and sometimes they only recognized where some of the song files were located. One thing I want to do—preferably not one at a time, but if one at a time, then in a way I won't have to turn around and do again—is get rid of these duplicate or partial playlists.


Additionally, over the past while, the Music app has also sometimes duplicated music files so that there are up to 3 copies of a song listed in the music library. I would like to find a way to clean that duplication up, again not one at a time if possible, but certainly in a way that it won't easily be repeated once cleaned up.


Finally, most recently, the Music app has also created a second Music folder within my iTunes media Music folder and moved a number of my music files to this Music-within-Music folder. I would prefer to have a simpler file structure with all the music files in a single Music folder on the external drive organized by artists as Music typically does it. Maybe there's some setting I'm using the wrong way under "Organize Library," but I'm not sure what it might be.


If there were a way to reorganize the files, first, then generate a new library based on them...but at the same time not lose all the older playlists that are still in decent shape, I'd be willing to try it. But at this point I'm too afraid to tinker with this for fear of creating even more duplicates and making the program virtually unusable.


I have tried talking with Apple Support on several occasions, but these attempts have usually just proved exhausting, not productive, and ultimately have been without helpful results.


Help?!

Tom

Posted on Jul 22, 2022 1:08 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 22, 2022 1:50 PM

Duplicate Playlists


Do you have any .m3u playlists stored within your media folder? These can be reimported if you add the media folder to the library in the hope of picking up any content that is in the media folder and isn't connected to the library. There have also been instances where syncing devices has caused duplication of playlists. Do the duplicate copies of the lists include some kind of index number, e.g. Playlist 1, Playlist 2. etc? I've written an AppleScript to clean these up, although right now I cannot find the thread which prompted it. Ah found it. Multiple playlists 111231441 etc - Apple Community.




Duplicate Songs


See Duplicate songs in iTunes - Apple Community.




File Structure


There is a legacy feature from iTunes found under File > Library > Organize Library > Rearrange Files. In iTunes this was used to move artist folders from their original location in the <Media Folder> down into <Media Folder>/Music so that each media type has its own folder. With Music only handling music it would actually make sense for Apple to allow this feature to be turned off, but as with iTunes it is only possible to turn reorganize files on, not off, and the default setting is on. If you really want Music to put new rips and downloads into <Media Folder> not <Media Folder>/Music then you need to open the hidden .Media Preferences.plist file inside your <Media Folder> with a text editor and change the integer value in to from 1 to 0. If you then turn Keep organized off and back on all content within the media folder will be rearranged to fit the chosen layout. Anything located outside the designated media folder stays where it is.




tt2


Similar questions

7 replies
Question marked as Top-ranking reply

Jul 22, 2022 1:50 PM in response to tccroc

Duplicate Playlists


Do you have any .m3u playlists stored within your media folder? These can be reimported if you add the media folder to the library in the hope of picking up any content that is in the media folder and isn't connected to the library. There have also been instances where syncing devices has caused duplication of playlists. Do the duplicate copies of the lists include some kind of index number, e.g. Playlist 1, Playlist 2. etc? I've written an AppleScript to clean these up, although right now I cannot find the thread which prompted it. Ah found it. Multiple playlists 111231441 etc - Apple Community.




Duplicate Songs


See Duplicate songs in iTunes - Apple Community.




File Structure


There is a legacy feature from iTunes found under File > Library > Organize Library > Rearrange Files. In iTunes this was used to move artist folders from their original location in the <Media Folder> down into <Media Folder>/Music so that each media type has its own folder. With Music only handling music it would actually make sense for Apple to allow this feature to be turned off, but as with iTunes it is only possible to turn reorganize files on, not off, and the default setting is on. If you really want Music to put new rips and downloads into <Media Folder> not <Media Folder>/Music then you need to open the hidden .Media Preferences.plist file inside your <Media Folder> with a text editor and change the integer value in to from 1 to 0. If you then turn Keep organized off and back on all content within the media folder will be rearranged to fit the chosen layout. Anything located outside the designated media folder stays where it is.




tt2


Jul 22, 2022 7:31 PM in response to tccroc

The steps I gave earlier under the heading File Structure will move any content in /Media/Music/iTunes External Drive/iTunes Media/Music/Music up into /Media/Music/iTunes External Drive/iTunes Media/Music.


If you want tidy however I'd be tempted to set the media folder as /Media/Music/Media. You could consolidate to the new path, assuming you have room to temporarily double up on your media content, or you could take advantage of macOS's ability to heal links to files moved around on the same volume, and move your current /Media/Music/iTunes External Drive/iTunes Media/Music folder up inside /Media/Music, then rename it as /Media/Music/Media. You'd still need to correct the .Media Preferences.plist file


tt2

Jul 22, 2022 2:06 PM in response to turingtest2

Thanks for this detailed suggestion. But since this is a little unfamiliar to me, let me just check something before I try it. I already had a "Music" folder in the iTunes Media folder. In it, were folders organized by artists, compilations, etc. But what Music did fairly recently was to create a new "Music" folder within this "Music" folder and put some of the artist folders in it as well as duplicating a few of the other folders (but not the contents) in the iTunes Media folder—one called "Automatically Add to iTunes" and another called "Automatically Add to Music" (neither of which works automatically any more, by the way).


Anyway, it seems I could either do the procedure you suggest, which I'm guessing would allow Music then to link the music it lists to the relocated files in the higher level Music folder (that is, within iTunes Media, not in the Music folder within the other Music folder). Would this also remove duplicate listings of songs or would those need to be cleaned up by hand most likely?


It doesn't sound like there's a way to just move the files now in this nested new "Music" folder back to the original one without then having to do other kinds of clean up of duplicates in the program.


But am I understanding what your suggestion should do correctly?


Jul 22, 2022 2:18 PM in response to tccroc

Regarding the playlists, I do have a few of the m3u playlists, but only a few. There are many more that I can't find others. Is there a likely place they would be located? (The ones I found were ones I had saved for use on an old phone.)


When you say add the media folder to the library, is that just a matter of using the file menu/import/then selecting the whole iTunes media folder? Yes, some of the duplicate copies contain a new number, but many do not. Some contain all the same songs, some have more than others. Some have only one song from the original playlist.


Thanks for the link to the script. Much appreciated.

Jul 22, 2022 5:32 PM in response to turingtest2

If I understand your question correctly, this is the current path that I had established for the location of my music media: /Media/Music/iTunes External Drive/iTunes Media/Music ("Media" in this case is the name of the external drive portion where all the music files are saved. I realize that there's already some naming duplication in my locations there. But what the Music program has done is add yet another "Music" folder within the final "Music" folder I created.) I'm open to advice on how best to clean this up.


Thanks for your advice on this.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I clean up Music app file structure and duplicate files and playlists?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.