You may not need the Cloud

Posted on August 19, 2022
Tags: IT

For many years I used a private Nextcloud instance to manage and sync my files across devices.

For the last two years I switched to Syncthing, a distributed solution, in the end I find it better and easier to maintain. I only have to install it to my devices, and my files are synced when I connect to my private network.

The only thing to take care of is that you will invariably get conflicts on day or another, Syncthing will keep a copy of every files in such a state, so you just have to manually solve the problem by diffing, it’s not a big deal when you get used to it.

But there is another thing that is provided by Nextcloud and not by Syncthing, it is the ability to organize your files by tags. I analyzed many solutions and ended up rolling my one: a simple Bash script that recognize tags in filenames as encoded inside parentheses, like so:

(tag1,tag2) foo

I also added a flag to the script that pipe the results to fzf, then to xdg-open upon selection.

You can find it here: https://github.com/BasicAcid/tagger

I know this format can seem a bit annoying, particularly when using the shell, because you will have to escape the parentheses (I use Fish and its completion is powerful enough so that this is not a problem, I don’t know for other shells), but the reason was mostly that it was easy to parse, and that none of my files contained a “(.)” pattern in the name (I think this is pretty uncommon).

(Edit) I re-wrote it in Haskell, I will outsource this version when I feel like it.

(Edit 2023-02-10) I changed the naming convention, after many tests I settled on this one:

+tag1,tag2+@foo

One obious advantage is that I don’t need to escape the parentheses nor the whitespaces anymore. Most applications are ok with filenames that begin with a plus, but I encountered complications here and there.