How can I delete all the files in my iTunes folder that are NOT in my library?

6

2

I believe there are music files in my iTunes folder that aren’t in my library. How can I remove these files?

Alan H.

Posted 2011-06-27T00:42:44.247

Reputation: 1 296

You don't say what your OS is. – BillP3rd – 2011-06-27T03:37:46.663

1If it is a relatively small library or one you don't mind moving, just select all of the files in itunes and copy them to a different location. Then delete the entire contents of the itunes folder, and reimport the songs/whatever. But only do this if you have backed up. Also, check to see if they are taking up much space, if not, then what is the harm in leaving them? – a sandwhich – 2011-06-27T05:03:41.917

Answers

2

Well, you can manually do it by exporting the list of music in your library by right clicking the Music in the top left frame and selecting "Export." Then you could compare this to what is inside of your iTunes folder.

This seemed kind of tedious and figured someone out there had already come up with an easier method:

http://dougscripts.com/itunes/scripts/ss.php?sp=musicfolderfilesnotadded2

The above script looks promising. As usual, you should back up your files before doing either of the above just in case!

Good luck.

baraboom

Posted 2011-06-27T00:42:44.247

Reputation: 784

Yes, this worked really well for me. Thank you. (Caveat: I’m on the latest iTunes beta and it seems the script is over-eager to show my ringtones as missing from iTunes when that isn’t really the case.) – Alan H. – 2011-06-30T18:51:03.147

7

Assuming OS X, although instructions should be very similar for Windows. Open iTunes -> Preferences -> Advanced. Click Change… beside iTunes Media folder location. Select a new location. Click OK.

Then head to File -> Library -> Organize Library…. Click Consolidate files. This will copy all files in your iTunes library to your new location, and will not copy files that are not in your library. Once the copy is completed, delete your old iTunes Media folder. If you like, you can repeat the process to consolidate files back to your original location.

fideli

Posted 2011-06-27T00:42:44.247

Reputation: 13 618

This works cross-platform - just performed this procedure on Windows 7/iTunes 11.0.5.5 – nchpmn – 2013-09-07T06:46:44.670

1

Not perfect, but I would try the following..

  1. Make sure that the files in question have an access time that is set to much older than the current files.

  2. Install MacPorts.

  3. Install the "find" command/program/utility

  4. Read the endless man page for find.

  5. Use find to list all files with an access time over some value you decide upon - dump their full path locations to a plain text file

  6. Write a tiny script to move everything from the plain text file to a location that you'll leave the files for a while to make sure you don't miss them once you delete them.

An alternative may involve making use of the iTunes preferences for keeping your music folder organized - maybe if you move where iTunes stores its music in your settings, it'll move just the files you're using?

James T Snell

Posted 2011-06-27T00:42:44.247

Reputation: 5 726

Do you really have to manually install find? Pretty sure mine came with - I'd be lost if I couldn't find! This would be the way I'd do it, too, probably. – baraboom – 2011-06-30T21:18:52.533