# Get destination filenames when importing

**URL:** <https://discourse.beets.io/t/get-destination-filenames-when-importing/1165>\
**Category:** Help\
**Created:** [March 19, 2020, 7:24am UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165 "2020-03-19T07:24:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thenoblesunfish](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/thenoblesunfish/32/380_2.png) [@thenoblesunfish](https://discourse.beets.io/u/thenoblesunfish)\
**Post date:** [March 19, 2020, 7:24am UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/1 "2020-03-19T07:24:21Z")

</div>

I’d like to be able to import a directory full of files (singletons, from different albums) and be informed where each file ended up in my library directory, so that I can make a playlist with those tracks. Is there already a way to get `beet import -s` to provide that information? (I don’t think so but I’m a n00b so am still overlooking obvious things.)

It also seems like it’d be straightforward to write a plugin to do this (say, set a listener for `item_imported` and have it call `item.destination()`), so that’d be my default plan of attack.

---

<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 19, 2020, 2:23pm UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/2 "2020-03-19T14:23:55Z")

</div>

Hi! Maybe try the `--set` option to the `import` command, which lets you set a flexible attribute on all the things that were imported? For example, `beet impost -s --set batch=playlist1 ./dir` would mark them so you can later find all the items with `beet ls batch:playlist1`. Or add `-p` to that latter command to get a list of paths.

---

<div class="post-metadata">

**Author:** ![thenoblesunfish](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/thenoblesunfish/32/380_2.png) [@thenoblesunfish](https://discourse.beets.io/u/thenoblesunfish)\
**Post date:** [March 20, 2020, 10:38am UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/3 "2020-03-20T10:38:15Z")

</div>

This works for my use case - thanks! I think I can make a little script which will pick a tag based on the time, e.g.

```auto
#!/usr/bin/env sh
tag=$(date +%Y%m%d_%k%M%S)
beet import -s --set batch=$tag "$@"
beet ls batch:$tag -p

```

As an aside, the same procedure doesn’t seem to work for an album import (e.g. `beet import --set batch=playlist1 ./album_dir`). I can still see the expected tag in the `batch` field with e.g. `beet list -f '$artist:$album - $title, $batch' foo`, but `beet list batch:playlist1` doesn’t give any results.

---

<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 20, 2020, 1:36pm UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/4 "2020-03-20T13:36:58Z")

</div>

You’ll want to use the `-a` flag to the `beet ls` command to list albums instead of items.

---

<div class="post-metadata">

**Author:** ![julz](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@julz](https://discourse.beets.io/u/julz)\
**Post date:** [December 30, 2020, 3:58am UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/5 "2020-12-30T03:58:29Z")

</div>

This is a nice solution, but how would one go about deleting the attributes after querying the db with `beet ls` ? That way we could use `batch=playlist1` as a temp playlist to get a list of path for one album only and not add to it for each import .

---

<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:** [December 30, 2020, 8:48pm UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/6 "2020-12-30T20:48:04Z")

</div>

`beet modify` can delete attributes using `!`.

---

<div class="post-metadata">

**Author:** ![julz](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@julz](https://discourse.beets.io/u/julz)\
**Post date:** [December 30, 2020, 9:11pm UTC](https://discourse.beets.io/t/get-destination-filenames-when-importing/1165/7 "2020-12-30T21:11:38Z")

</div>

working perfectly, thank you 👍
