Walkthrough ----------- # Let's mount up a new instance with a persistent SQLite datastore $ mkdir ~/music # This is a new directory for mounting $ cbtagfs -f ~/.cbtag-music ~/music # Tags are treated like directories. Let's create a few. $ cd ~/music $ mkdir rock $ mkdir new # Files are added (and served) as symlinks. # We can add a file without any tags... $ ln -s /mp3s/still_alive.mp3 ~/music # ...or add some tags at the same time by linking into a directory. $ ln -s /mp3s/We_Built_This_City.mp3 ~/music/rock/ # To see all files indexed by cbtags, just list the mountpoint: $ ls -l ~/music total 2 drwxr-xr-x 1 root root 10 Apr 17 17:55 new drwxr-xr-x 1 root root 10 Apr 17 17:55 rock lrwxrwxrwx 1 root root 10 Apr 17 17:55 still_alive.mp3 -> /mp3s/still_alive.mp3 lrwxrwxrwx 1 root root 10 Apr 17 17:55 We_Built_This_City.mp3 -> /mp3s/We_Built_This_City.mp3 # Above, you can see that tags are listed as directories, and files are # actually symbolic links pointing back to their originals. # But let's see something more interesting: $ ls -l ~/music/rock total 1 lrwxrwxrwx 1 root root 10 Apr 17 17:56 We_Built_This_City.mp3 -> /mp3s/We_Built_This_City.mp3 # This queries cbtagfs for all files that match the "rock" tag. # Let's add a few more tags. $ cd ~/music $ mv still_alive.mp3 rock $ mv still_alive.mp3 new # The above commands aren't actually moving the file around, but associating # new tags with it. # Now, listing the "rock" tag finds both files: $ ls -l ~/music/rock total 2 drwxr-xr-x 1 root root 10 Apr 17 17:59 new lrwxrwxrwx 1 root root 10 Apr 17 17:59 still_alive.mp3 -> /mp3s/still_alive.mp3 lrwxrwxrwx 1 root root 10 Apr 17 17:59 We_Built_This_City.mp3 -> /mp3s/We_Built_This_City.mp3 # Whereas listing the "new" tag only finds one: $ ls -l ~/music/new total 1 drwxr-xr-x 1 root root 10 Apr 17 18:00 rock lrwxrwxrwx 1 root root 10 Apr 17 18:00 still_alive.mp3 -> /mp3s/still_alive.mp3 # In both of these cases, you can see the other tag listed as a subdirectory. # You can filter by multiple tags at the same time like this: $ ls -l ~/music/rock/new total 1 lrwxrwxrwx 1 root root 10 Apr 17 18:02 still_alive.mp3 -> /mp3s/still_alive.mp3 # Order doesn't matter, so this is equivalent to: $ ls -l ~/music/new/rock total 1 lrwxrwxrwx 1 root root 10 Apr 17 18:02 still_alive.mp3 -> /mp3s/still_alive.mp3 # To remove a tag, just rm the file from the tag's directory: $ rm ~/music/rock/still_alive.mp3 # remove the "rock" tag $ ls -l ~/music/new/rock total 0 # it disappears from "new + rock" $ ls -l ~/music/new # but is still there under just "new" total 1 lrwxrwxrwx 1 root root 10 Apr 17 18:02 still_alive.mp3 -> /mp3s/still_alive.mp3