NAME
squaretag - tag files by using filenames
SYNOPSIS
squaretag add [--verbose|-v] [--dry-run|-n] [--force|-f] TAG FILES...
squaretag remove [--verbose|-v] [--dry-run|-n] [--force|-f] TAG FILES...
squaretag clear [--verbose|-v] [--dry-run|-n] [--force|-f] FILES...
squaretag rename [--verbose|-v] [--dry-run|-n] [--force|-f] OLD_TAG NEW_TAG FILES...
squaretag list FILES...
squaretag search SEARCH FILES...
squaretag untagged FILES...
DESCRIPTION
Squaretag helps you to organize your files by tagging them. The tags are saved in the filename by adding all tags in square brackets either at the end of the filename or just before the last dot.
EXAMPLES
Suppose the current directory contains the following files:
$ squaretag untagged
picture01.jpg
picture02
Now you want to add the tag family to all pictures.
$ squaretag add -v family *
picture01.jpg -> picture01[family].jpg
picture02 -> picture02[family]
Files can have multiple tags
$ squaretag add -v myself picture01[family].jpg
picture01[family].jpg -> picture01[family,myself].jpg
You can rename single tags
$ squaretag rename -v myself me picture01[family,myself].jpg
picture01[family,myself].jpg -> picture01[family,me].jpg
Or delete a tag
$ squaretag remove me -v picture01[family,me].jpg
picture01[family,me].jpg -> picture01[family].jpg
And what would tags be good for if you couldn't search for them
$ squaretag search 'family && !me' *
picture02[family]
And if you have enough, you can simple clear all tags
$ squaretag clear *
picture01[family].jpg -> picture01.jpg
picture02[family] -> picture02
Tags can also have values:
$ squaretag add read=2016 book.epub
$ squaretag search 'read>2010' *
books[read=2016].epub
$ squaretag search 'read<2010' *
$ squaretag search 'read=2016' *
books[read=2016].epub
COMMANDS
- add TAG FILES...
-
Add TAG to FILES. TAG is a comma seperated list of tags to add. If a tag has a suffix of - this tag will be removed from the file.
- remove TAG FILES...
-
Remove TAG from FILES. TAG is a comma seperated list of tags to remove. If a tag has a suffix of + this tag will be added to the file.
- search SPEC FILES...
-
List all FILES that match the search SPEC. SPEC can contain tags and the usual boolean operators.
For example:
read && good !read || (not_read && prio )
There are three additional operators <, = and > to handle tags with values. The = compares its operand as strings, the other two just work on numerical tags.
- clear FILES...
-
Remove all tags from FILES.
- rename OLD_TAG NEW_TAG FILES...
-
Rename OLD_TAG in NEW_TAG in all FILES.
- list FILES...
-
List and count all tags for FILES. The tags are sorted in descending order of frequency.
- untagged FILES...
-
List all FILES without a tag.
RATIONALE
Tagging files in a way that tags are preserved cross-platform or even cross-filesystem seems to be a hard problem with no clear cut solution.
Fileformat
Some file formats as mp3 or pdf support saving tags inside the files but there a a lot (probably most) that don't. And even the former need special programs to do that.
Filesystem
Many modern file systems support tags and special meta data streams, but the tags are most likely lost when you copy files from one file system to the next.
External database
Keeping the tags in a external database requires a sync step after moving or deleting files. This is harder than it sounds, you probably need the keep checksums to reckognize known files after a rename.
Filename
All filesystems limit the length of the filename, so the number of tags you can save per file is also limited. And even before you reach the limit, the filename will be hard to read.
But at least it works for all kinds of files, it not dependent on your file or operating sytemen is does not need external tools or syncing steps.
SEE ALSO
COPYRIGHT AND LICENSE
Copyright 2016 Mario Domgoergen <mario@domgoergen.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.