squaretag - tag files by using filenames
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...
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.
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
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 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.
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.
Remove all tags from FILES.
Rename OLD_TAG in NEW_TAG in all FILES.
List and count all tags for FILES. The tags are sorted in descending order of frequency.
List all FILES without a tag.
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.
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.
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.
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.
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.
tmsu, tagspaces
Copyright 2016 Mario Domgoergen <mario@domgoergen.com>
<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/>.
To install squaretag, copy and paste the appropriate command in to your terminal.
cpanm
cpanm squaretag
CPAN shell
perl -MCPAN -e shell install squaretag
For more information on module installation, please visit the detailed CPAN module installation guide.