Clean up library folders without moving?

I recently went through the effort of importing ~30k tracks into management with beets. Everything went fairly well aside from a few issues with missing files, etc. The one decision I made is that I didn’t want any duplicate albums on this first import. If, down the road, I decide to add a specific version of an album I can re-add that later. As such I was replacing a lot of albums during the import. One example is ‘Pink Floyd - The Wall’ since there are about 200 versions of that album :).

So what happened is that I now have quite a few folders with one file in them. Typically the file is ‘albumart’. Previously while organizing my library with another manager, it would move non-audio files with the music files. This was nice to preserve scans or whatever, but also nice because it’s really easy to find and delete empty directories.

Obviously I could probably write a script to find all folders with only 1 file in them and manually delete, or even search for albumart as the only file, etc. However, is it possible with beets to remove all folders in the library directory that are not managed by beets?

My other thought is that I could use beets to move my library from /Albums to /Albums1 and then delete everything in /Albums and move it back. Any concerns before I go down this path?

There is nothing that specifically does this:

But you’re right; just doing a beet move to a new directory and then beet moveing the files back should work great!

Some other things to be aware of:

  • Use the fetchart plugin to pick up image files alongside music files.
  • Use the clutter option to configure how beets automatically deletes non-music files in otherwise-empty directories.
  • See the third-party extrafiles plugin for moving arbitrary files alongside music.
2 Likes

Thanks for the hints. I’ll read up on these plugins/options and give my library a refresh today.

Quick question on the move. I have my music library mounted at /music which is actually /mnt/music/Library/Albums. If I change the mount point of /music to be /mnt/music/Library and then update my directory setting to /music/Albums that will probably screw up the whole database, right?

I think my best step here is to just use the logical paths for moving and not messing with the library/directory setting.

Nevermind. I set the mount point wrong and messed up my library so I’m just going an import in the new location.

OK, sounds good. FYI, there is an FAQ about relocating your library.

Yeah, I’m using that. I realized after asking my question that it’s very specific to my situation and doesn’t really apply to beets. I was trying to determine what it would do if I changed the mount point of my music under beets’ config for the directory. I’m just doing this the long way now since it’s the most straight forward.

I realize this topic is about a year old, but that extrafiles plugin looks great. Is there any chance it might be included with beets at some point?

I agree that it would be awesome for beets to have robust built-in support for managing companion/non-music files. However, I’d caution against the extrafiles plugin in its current form. It’s buggy. I was initially happy to find it, but after using it in practice, I noticed non-music companion files sometimes disappearing (i.e. being deleted). Someone would need to write some integration tests for it that exercise various scenarios, to prove that it works properly in combination with e.g. beet move. Caveat emptor.

i think i have issues like those in this thread: the items path built into the database does not match where the music files are being mounted. i tried using beet move with the directory specifying the new location, but it wants to create some new directory? can you spell out just how you intend the <beetDirectory>+<itemPath> to look, and i’ll just go thru and change the sqliteDB to make them appropriate. thanks!