file-tag

July 15, 2010 at 23:16
filed under   |   4 comments (Leave a comment)

Share on RedditShare on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponPrint this page

[TOC]

What is this?

It is a program that lets you tag your files.
It "replaces" your directories with your tags.
Instead of /dir1/dir2/dir3/my-file you get /a-tag/b-tag/my-file or /b-tag/my-file or /b-tag/c-tag/a-tag/my-file etc.

What does it do?
It lets you tag your files
Is it useful?
If tagging your files is useful... YES!
Why you want it?
1. I like tags better than trees for most of my data
2. I like it that /programs/source/c/ is the same as /c/source/programs (but semantically different).

Usage

Command line mode

Available commands:

add <tags> <file>
add tags to file

#add tags important, pdf and guide to important_guide.pdf:
> ftags add important pdf guide important_guide.pdf
#add tags pdf and guide to latex_guide.pdf:
> ftags add pdf guide latex latex_guide.pdf
> ftags add important note.txt
> ftags add pdf balance.pdf
rm <tags> <file>
remove tags from file
cp <from-file> <to-file>
copy tags of a file to another
ls <tags>
list files that have the given tags

> ftags ls important
important_guide.pdf
note.txt
> ftags ls pdf guide
important_guide.pdf
latex_guide.pdf
ls -t <tags>
list non-empty tags that have the given tags.

> ftags ls -t guide
important latex pdf
> ftags ls -t guide pdf
important
tags/lstags [ -fs ]
List all tags of a file. With "-fs" path tags are also shown (see notes).

> fstags tags /home/afile.pdf
funny pdf temp
> #or
> lstags /home/afile.pdf
funny pdf temp

File system emulation mode

To enter "file system emulation" mode, run fstag_shell. In this mode, the following buildin commands change theif function. All other commands work as in 'command line' mode.

cp
Adds tags to a file

cp /afile.txt /atag/btag/

Adds 'atag' and 'btag' to 'afile.txt'

rm
Removes tags from files. When a file has no tags, it is deleted.

rm /atag/afile.txt #remove tag 'atag' from 'afile.txt'
#if 'atag' was the only tag for this file, it is deleted.
rm /afile.txt #remove all tags from 'afile.txt'.
mv
remove source tags, add target tags:

mv /atag/btag/afile.txt /ctag/afile.txt
mkdir
Prepare a new tag = Show a tag even if it's empty. (Not really necessary but maybe helpfull sometimes)
cd
Change active tags:

cd /atag/ctag/
#atag and ctag are the active tags now
cd ..
#atag is the only active tag now
ls
List all files tagged with the given tags (default: active tags):

cd /atag
ls #list all files tagged with 'atag'
ls /atag/btag/ #list all files tagged with 'atag', 'btag'
ls -t
List all non-empty tags having the given tags:

> ls -t /guide/
important/ latex/ pdf/
> ls -t /guide/pdf/
important/

dup duplicates a file. It is the equivalent of regular cp.

Notes

/ (slash) is the "any" tag.

New files are stored under ~/.file-tag/fs/

Duplicate filenames are permited. If two files have the same name and appear at the same listing, they'll have a consistently different suffix. Eg:

> touch /atag/btag/afile.txt
> touch /atag/ctag/afile.txt
> ls /atag/
afile.txt-ao3 afile.txt-9cc
> ls /btag/
afile.txt
> ls /ctag/
afile.txt
> touch /btag/dtag/afile.txt
> ls /btag/
afile.txt-9cc afile.txt-e8r

The "real" file system tree is tagged with read only tags: The path is prepended with "path_" and added as a tag.
These tags are hidden and ignored by default. To see them, add "-fs" to lstags command. Eg, the file /home/tmp/main.c has tags:

> lstags -fs /main.c
path_home path_tmp

Examples

You are working on your "my new project" project. You add this tag to some of your files:

> mkdir /my_new_project; cd /my_new_project
> touch mylibs.h mylibs.c main.c Makefile
> ls
Makefile main.c mylibs.c mylibs.h

You need to have some of this files separate for other purposes, so you add some more tags:

> cp Makefile /makefiles/ #add tag 'makefiles' to Makefile
> cp mylibs.* /libs/  #add tag 'libs' to mylibs.*
> cp * /projects/source/ #add tags 'projects' and 'source' to *
> ls /source/projects/makefiles/
Makefile
> ls /libs/my_new_project/
mylibs.c mylibs.h
> rm /libs/mylibs.c #removes the TAG 'libs' from mylibs.c
> rm /mylibs.c #removes all tags from 'mylibs.c' (thus deleting the file)

You want to see what's "important":

> cd /important
> ls
important_guide.pdf
note.txt

You want to find all your pdf guides:

> cd /pdf/guide
> ls
important_guide.pdf
latex_guide.pdf
# OR
> cd /guide/pdf
> ls
important_guide.pdf
latex_guide.pdf

> cp /guide/pdf/latex_guide.pdf /latex/
> lstags /latex/latex_guide.pdf #list all tags for this file
guide latex pdf
> mv /guide/pdf/latex_guide.pdf /latex/
> lstags /latex/latex_guide.pdf
latex

Frontend

There is a two pane file-manager-like frontend for file-tag.
Screenshots soon.

Downloads

Available by Dec/2010

No tips yet.
Be the first to tip!
Like this post? Tip me with bitcoin!

1A4Y6xj4KQEgp9SCSbkSTiugXvAfMehtx2

Share on RedditShare on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponPrint this page

4 comments

RSS /

respond

  1. Manos

    on August 26, 2010 at 19:10

    Great stuff! I plan to use it for sorting my paper repository, which I never managed to maintain properly so far. A paper can go in so many different folders; actually, it can go in any folder depending on what I want it for. 😉

    PS: file-tag was your holidays destination I imagine? 🙂

    [Reply]

  2. Andrew

    on December 8, 2010 at 15:48

    So I guess we should see both file-tag and the GUI available sometime this month, right?

    [Reply]

    eelvex Reply:

    Actually I'm just weighting hosting options (sourceforge, savannah or launchpad - any hints?), so yes... very soon.
    Thanks for asking 🙂

    [Reply]

    Andrew Reply:

    I've only used Launchpad and Google Code so... (and I like Launchpad - it's easier to use, track bugs and so on). But whatever you use, it'd be nice to also have a Launchpad PPA for Ubuntu users so it's easy to install 😀

    [Reply]

Real Time Analytics