Command to update tmsu database after moving a directory tree with lots of tagged files?

90 views
Skip to first unread message

____________ ________

unread,
Jul 22, 2012, 2:00:30 AM7/22/12
to tm...@googlegroups.com
Greetings, new tmsu user here.

I've fiddled a bit with tmsu and there's one particular scenario that I'm not happy with. So I've created some throwaway files, added some tags. Mounted the virtual filesystem using `tmsu mount`. Then I have moved a tagged file to another directory. I have noticed two things:

1. The symlink for this file in corresponding directory for tag inside virtual filesystem got broken.
2. Doing `tmsu tags file` against the file in his new location yields no results, so it looks like moving a file breaks its tag associations.

This behavior is the expected one, since tmsu can't know when I move tagged files - it's a standalone program not a daemon that would watch for files being moved via some inotify-like mechanism.

However, when looking in the database that tmsu is using, there's that "fingerprint" column in the "file" table that looks like a cryptographic hash and is probably using for tracking uniqueness of files.

Is there a command that can tell tmsu sync its database against changes in the filesystem (as in moving/renaming a directory)? It would walk a given directory tree, match every file there against fingerprints in the database and automatically add tags for it. After that it can iterate over all files in the database and purge the records of missing files. I see that directory + name columns in the file table form an absolute file path, which may change when a file gets moved to another directory / gets renamed.

I quickly went over tmsu docs and couldn't find how to achieve such a sync.

Please point me to the right place to read about it if I've overlooked something in the docs. Otherwise please consider this a feature request, I see this as a major show stopper while using tmsu in scenarios when files get often moved / renamed. The sync functionality could solve problem 2. from my scenario automatically, without having to manually reassign all the tags after moving / renaming a file (which would be a pain for a lot of files). Problem 1. would be solved by remounting the virtual filesystem after performing the described above sync.

Paul Ruane

unread,
Jul 22, 2012, 3:22:34 AM7/22/12
to tm...@googlegroups.com

Hi,

The command you are after is called 'tmsu repair'. This will handle file moves and file content changes, i.e. moved files with the same fingerprint are identified and unmoved files with a different fingerprint are updated.

You can run 'tmsu help repair' for documentation or see the page in the wiki: https://bitbucket.org/oniony/tmsu/wiki/repair_command.

Thanks,
Paul

Reply all
Reply to author
Forward
0 new messages