Neversearch
Provide a way to easily find / tag files and folders on UNIX systems with xattr support on filesystems. Currently known to work on Linux.
Features
- Tagging files using xattr
- Simple, yet powerful frontend
- Adheres to UNIX philosophy, integrates nicely with other UNIX tools
Supports Python >2.7 and 3 (also depends on either one)
Future work
- Database-like cache (initial db, incremental updates)
- Helper aliases / (bash) functions
- Remove dependency Work without python-xattr
- tag-fs (based on db, with fuse)
Dependencies
python-xattr (http://pyxattr.k1024.org/)
Media
Neversearch @ Openfest 2013: http://va.ludost.net/files/of2013/Day1/Hall_Sofia/05.Lightning/03.Neversearch%20-%20Merlijn%20Wajer.mp4
Code
http://github.com/MerlijnWajer/neversearch
Example
Tagging files
Adding a tag is as simple as:
$ tag -a my_brand_new_tag my_file
Doing the same, recursively:
$ tag -ra 2013 ~/photos
Unicode is supported, too!
$ tag -a ♥ ~/photos/wizzup.png
Listing tags
Listing tags:
$ tag -l ~/photos/wizzup.png ~/photos/wizzup.png: 2013, ♥
Recursively listing tags:
$ tag -rL ~ # (output not shown)
The difference between -L and -l is simple: -L omits files that contain no tags, whereas -l does not.
Deleting tags
$ tag -d ♥ ~/photos/wizzup.png $ tag -C ~/photos/wizzup.png
Finding and filtering
Filters use regular expressions (Regex):
$ tag -rHf python /tmp/ /tmp/foo (python) /tmp/foo/quux (python) /tmp/foo/bar (python) /tmp/foo/bar/wobble (python) /tmp/foo/bar/fred (python)
Having neversearch read files from stdin is also possible:
$ find /tmp/ | tag -f python /tmp/bar/foo /tmp/bar/foo/quux /tmp/bar/foo/bar /tmp/bar/foo/bar/wobble /tmp/bar/foo/bar/fred
And finally, you can chain neversearch:
$ tag -rf python /tmp/foo | tag -f 2012 | tag -L /tmp/foo/quux: python, 2014, 2012 /tmp/foo/bar: python, 2014, 2012 /tmp/foo/bar/wobble: python, 2014, 2012 /tmp/foo/bar/fred: python, 2014, 2012 /tmp/foo: python, 2014, 2012
Export
Exporting is very useful if you are planning to copy tags to a filesystem that does not support extended attributes (xattr). You can save the filenames and the associated tags to a file and later on apply the tags again when you have a filesystem that does support xattr.
Be careful if you want an absolute or relative path:
Absolute:
$ tag -rE /home/user/my_photos > /home/user/photo_tags
Relative:
$ cd /home/user/my_photos $ tag -rE . > /home/user/photo_tags
They are very different. I would recommend using relative where possible. If you use relative, make sure you are in the proper folder when importing, too
You can again also use find and have neversearch read from stdin. This way you can also exclude paths using grep.
$ find /path | grep -v '/path/some_path' | tag -E > /home/user/photo_tags
Import
See the above section on exporting. Assume we've stored tags in /home/user/photo_tags
$ tag -V -I /home/user/photo_tags
Remove the -V flag if you do not care about verbosity.
Database?
$ tag -rL /tmp > udb … $ grep python udb /tmp/foo: python, 2014, 2012 /tmp/foo/quux: python, 2014, 2012 /tmp/foo/bar: python, 2014, 2012 /tmp/foo/bar/wobble: python, 2014, 2012 /tmp/foo/bar/fred: python, 2014, 2012
Presentation
http://wizzup.org/neversearch.pdf
Progress
tag program (MOSTLY):
add tag
delete tag
remove all tags
list tags
filter tags
Any of the above, recursively
export tags to file
import tags to file
Search program using tags (grep + db trick in examples)
- Patch mlocate for searching xattrs
- Honour .locate-tags file
- umask-like alternative for tags; inherit tags from folder? (or just use folder) ; can be done with Tracy or LPD