-
Notifications
You must be signed in to change notification settings - Fork 127
Tricks and Tips
To copy tag our picture artichoke.jpg
with the same tags as avocado.jpg
:
$ tmsu tag --from=avocado.jpg artichoke.jpg
$ tmsu files photograph country | xargs tmsu tags
/home/fred/photos/DCSC-142.jpg: country=uk daytime good landscape photo manual-focus
...
$ tmsu untagged
In a negative query, where you are looking for files that don't have a particular tag or tags, you may want to include untagged files:
$ tmsu files --path /animals not hairy && tmsu untagged /animals
$ for tag in $(tmsu tags); do echo ${tag}: $(tmsu files ${tag} -c); done | sort -t: -k 2 -n -r | column
TMSU does not make any changes to your files in the filesystem (other than to its own database). As such, TMSU does not include any functionality for moving or renaming files. To make these operations easier, TMSU now includes a set of scripts for performing these operations:
$ tmsu-fs-rm path/to/file
Alternatively this can be done manually:
$ rm path/to/file && tmsu untag --all path/to/file
$ tmsu-fs-mv path/to/file new/path
Or manually:
$ mv path/to/file new/path && tmsu repair --manual path/to/file new/path
Sometimes you may wish to remove duplicates of a file, e.g. as identified by tmsu dupes
. To combine multiple files into one, preserving all of the taggings:
$ tmsu-fs-merge path/to/file1 path/to/keep
This will delete all but the last file specified, applying the tags from each file deleted to the final file.
To do this manually:
$ tmsu tag --from=path/to/file1 path/to/keep && rm /path/to/file1 && tmsu untag --all /path/to/file1
The versatility of TMSU means it isn't very difficult to extract tags from text files (e.g. Markdown) and feed them into TMSU, for example the following could be used to extract #tags
from markdown files in the current directory and assign tags to them:
rg --pcre2 '(?<=\s#)[a-zA-Z]+(?=\s)' -t markdown -o \
| sed s+:+\ + | sed s/^/tmsu\ tag\ / | bash
Other users have also implemented strategies for extracting YAML tags see for example this repository