# Keeping source/original folder name

**URL:** <https://discourse.beets.io/t/keeping-source-original-folder-name/308>\
**Category:** Help\
**Created:** [March 12, 2018, 8:10pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308 "2018-03-12T20:10:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Offspring](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@Offspring](https://discourse.beets.io/u/Offspring)\
**Post date:** [March 12, 2018, 8:10pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/1 "2018-03-12T20:10:06Z")

</div>

I know this probably isn’t the primary usage for beets, but I’m trying to re-organize my music collection. I got beets setup and it’s pretty awesome, but one of the major things I want, that hasn’t happened and I would love to automate, is moving all of the albums from one big folder (like I have now) into something like:

Root  
–Artist  
–Album  
–Album  
–Album  
–Album

This is easily done, but what I want is to keep the original folder naming convention for the Album section, so like the following:

Limp\_Bizkit-Chocolate\_Starfish\_and\_the\_Hot\_Dog\_Flavored\_Water-2000-OFFY  
Queen\_Boxed\_Set-2000-OFFY  
Slipknot-Disasterpieces-2002-OFFY  
VA-Godzilla\_OST-1998-OFFY  
VA-Rock\_Sound\_Vol.42-2001-OFFY

How can I keep all of that info? I thus far can get AlbumArtist-Album-Year but that’s about it.

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [March 12, 2018, 8:56pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/2 "2018-03-12T20:56:01Z")

</div>

Interesting! The beets philosophy is that you should be able to generate the filenames for everything based on information in the database. So it can help to start by thinking about what _rules_ define your filenames. For example:

- `$albumartist-$album-$year`. That’s easy enough to do with the beets `paths` configuration.
- Use underscores in place of spaces. You can do that with the `replace` config option.
- An extra suffix: what’s going on there? Is it always `OFFY`, or does it mean something? You could create an attribute for storing this piece of information and then include it in your template.

---

<div class="post-metadata">

**Author:** ![Offspring](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@Offspring](https://discourse.beets.io/u/Offspring)\
**Post date:** [March 12, 2018, 9:14pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/3 "2018-03-12T21:14:31Z")

</div>

The suffix is usually the group that released it, in this case I ripped those CDs myself and tagged them as such.

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [March 12, 2018, 9:34pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/4 "2018-03-12T21:34:15Z")

</div>

Cool! Then I’d suggest you use a new field, called `releaser` or something, and put the data there. You can use `beet modify -a releaser=foo some_album` to do that, and then include `$releaser` in your path format template.

You could even imagine automating that with a little scripting effort.

---

<div class="post-metadata">

**Author:** ![Offspring](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@Offspring](https://discourse.beets.io/u/Offspring)\
**Post date:** [April 28, 2018, 4:24pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/5 "2018-04-28T16:24:09Z")

</div>

Hey Adrian, where exactly would I add the new field? I’ve been banging my head against a wall. Basically, is it possible to ELI5 for someone who’s not versed in how this thing actually works?

Separately, is it possible to call beets from an external python source?

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [April 28, 2018, 4:39pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/6 "2018-04-28T16:39:32Z")

</div>

There’s actually nothing to do to “add” a new field—just start using it! Using the `modify` command I gave above should be all you need to do.

---

<div class="post-metadata">

**Author:** ![Offspring](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@Offspring](https://discourse.beets.io/u/Offspring)\
**Post date:** [April 28, 2018, 4:52pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/7 "2018-04-28T16:52:50Z")

</div>

Oh, well I feel dumb. I’ll try it out when I get back home. What about the other question regarding external python sources? Is that doable?

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [April 28, 2018, 5:11pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/8 "2018-04-28T17:11:57Z")

</div>

Oh right—yes, it is possible to `import beets` from another Python program and do some work there. It does require a few tricks, however, to set up a `Library` object and run queries against it. There are a few other threads about this topic on this Discourse and in GitHub issues—it might be possible to find some good hints by searching for things like “beets as a Python library.”

---

<div class="post-metadata">

**Author:** ![Offspring](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@Offspring](https://discourse.beets.io/u/Offspring)\
**Post date:** [April 28, 2018, 7:01pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/9 "2018-04-28T19:01:44Z")

</div>

> [@adrian](#):
>
> modify -a releaser=foo some\_album

So just to follow up on this, it looks like the “foo” part is static, which is where you were referring to scripting it to automate it, since I’ve got ~300 groups I’d like to keep, right?

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [April 28, 2018, 8:05pm UTC](https://discourse.beets.io/t/keeping-source-original-folder-name/308/10 "2018-04-28T20:05:48Z")

</div>

Yep, that’s exactly it.
