How many tags am I using and how often?

When dealing with tags, you often wonder what tags you are using most, which ones you really don’t use, etc. Yo might want an “inventory” of your tags, especially to find out which one you rarely use.

Again, the shell comes to the rescue. :slight_smile:

You need „tag“ on your computer, installed either through MacPorts or Homebrew.

Then, open a shell (“Terminal”) and navigate to the folder you want to create a tag inventory of. For the noobs, the command is “cd” (change directory), so:

cd Documents/Stuff

or whatever folder you have. You can use completion (tab key) or even type cd and then pull the folder from the Finder into the shell to avoid typing.

Then you run this command(s):

find . -type f > ~/Desktop/filenamestolookat.txt;cat ~/Desktop/filenamestolookat.txt | while read line; do tag -l -N -g $line;done > ~/Desktop/thetagsunsorted.txt;cd ~/Desktop/;cat ~/Desktop/thetagsunsorted.txt | sort | uniq -c | sort -r > ~/Desktop/sortedtags.txt;rm ~/Desktop/filenamestolookat.txt;rm ~/Desktop/thetagsunsorted.txt

The you’ll have a text file containing all your tags, sorted by occurrence.