# A way to query whether items have been tagged by beets?

**URL:** <https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057>\
**Category:** Help\
**Created:** [March 15, 2022, 9:06pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057 "2022-03-15T21:06:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![martimpassos](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@martimpassos](https://discourse.beets.io/u/martimpassos)\
**Post date:** [March 15, 2022, 9:06pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/1 "2022-03-15T21:06:18Z")

</div>

I went the fast way and imported my collection without any tagging, planing to come back and incrementally tag it using `beet import -L`.

As I probably won’t be able to tag it all in one session, is there some way to query items that haven’t been tagged by beets (probably by an inverted query) so I don’t have to skip through the ones I already processed?

I thought of doing this process by artist first letter (`beet import -L albumartist::^[aA]`,etc), or by the ones that don’t have MB IDs (`beet import -L mb\_albumid::^$) but that’s not very robust.

I suppose I could also use [noimport](https://gitlab.com/tiago.dias/beets-noimport) but that would mean keeping track of what I have tagged somewhere else. Appreciate any ideas here!

---

<div class="post-metadata">

**Author:** ![martimpassos](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@martimpassos](https://discourse.beets.io/u/martimpassos)\
**Post date:** [March 16, 2022, 5:30am UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/2 "2022-03-16T05:30:20Z")

</div>

Just came across `data_source` while exploring `beet fields`. Is it safe to assume that untouched files will match `data_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:** [March 16, 2022, 11:28am UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/3 "2022-03-16T11:28:26Z")

</div>

Yes, that’s the idea.

---

<div class="post-metadata">

**Author:** ![martimpassos](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@martimpassos](https://discourse.beets.io/u/martimpassos)\
**Post date:** [March 16, 2022, 2:01pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/4 "2022-03-16T14:01:41Z")

</div>

great, thanks!

---

<div class="post-metadata">

**Author:** ![martimpassos](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@martimpassos](https://discourse.beets.io/u/martimpassos)\
**Post date:** [March 16, 2022, 6:40pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/5 "2022-03-16T18:40:21Z")

</div>

Related question: `beet list -f $path data_source::^$` prints empty strings for me, although the query without formatting works fine. What could be going wrong here? Other queries with this particular formatting also return empty.

Relatedly, `beet info -l -i 'path' artist:Lee Marrow` prints all item fields, whereas `beet info -l -i 'title' artist:Lee Marrow` just prints titles as expected.

---

<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 16, 2022, 6:55pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/6 "2022-03-16T18:55:42Z")

</div>

You may want to put quotes in `-f '$path'`. Otherwise, your shell is probably substituting that for an empty string. (Try typing `echo $path`, for instance, for a glimpse at what your shell is seeing.)

---

<div class="post-metadata">

**Author:** ![martimpassos](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@martimpassos](https://discourse.beets.io/u/martimpassos)\
**Post date:** [March 16, 2022, 7:08pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/7 "2022-03-16T19:08:53Z")

</div>

Bullseye. `unset $path` did the trick, thanks again!

---

<div class="post-metadata">

**Author:** ![martimpassos](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@martimpassos](https://discourse.beets.io/u/martimpassos)\
**Post date:** [March 16, 2022, 9:01pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/8 "2022-03-16T21:01:31Z")

</div>

aaaand it’s back, and `unset` no longer works. Is this something beets is doing or bash itself? Any ideas for a permanent fix? `echo $album` also returns an empty string, for instance…

---

<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 16, 2022, 10:20pm UTC](https://discourse.beets.io/t/a-way-to-query-whether-items-have-been-tagged-by-beets/2057/9 "2022-03-16T22:20:31Z")

</div>

How about the single quotes I mentioned above?
