| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| global.h | 2011-01-08 | 563 Bytes | |
| global.c | 2011-01-08 | 2.7 kB | |
| tag.c | 2011-01-08 | 14.2 kB | |
| update.c | 2011-01-08 | 4.6 kB | |
| tag.cfg | 2011-01-03 | 63 Bytes | |
| Makefile | 2010-12-31 | 78 Bytes | |
| readme | 2010-12-29 | 3.1 kB | |
| Totals: 7 Items | 25.3 kB | 0 |
Purpose Apply tags to files to facilitate searching and organization. Method There is no metadata in standard files to tag, so we'll store tags in a local database. I'm thinking of a SQLite database, stored in the home directory, but this could be changed. The database would contain two tables: one is the filename (including its path) with its inode; the second relates the inode to one or more tags. Usage tag [-a taglist] [-r taglist] [-d database] [-c config] [-l] [-s taglist] [-v] [-u] [filename] If filename is not specified, default to all files in the current directory taglist should be a list of tags, separated by commas, no spaces Without any options, print a usage statement and exit. Options for a different database, different configuration file -a Add tag (use filenames) -r Remove tag (use filenames) -d Use database (deferred) -c Use configuration file -u Update database -l List tags (use filenames) -s Search for tags -v Version info Configuration file might include 1. Directory and subdirectories to search (or multiple directories?) - this will be used in case the file can’t be located, and we have to search for it by inode. 2. Should a file be deleted from the database if it can’t be found? 3. When searching for files, should they be located on disk to verify its existence? 4. Consideration for case sensitivity in searches 5. User-defined output Errors 1. Can’t find/create the database - ABORT 2. Can’t find configuration file - Don’t abort. Use default values. 3. File not found (trying to tag or untag a non-existent file) - ABORT Output (as a consequence of the Search command) Filename (with directory) Does it currently exist in its known location? If it doesn’t exist, was it moved? If it can’t be found, was it deleted from the database or retained? Example: /home/todd/docs/mydoc.txt located /home/todd/docs/another.txt moved <-- this may not be necessary, as the user only wants to know where the file currently lies. If it was moved and found, maybe it should just be “located” /home/todd/docs/yetanother.txt not found deleted /home/todd/docs/more.txt not found retained Might also have an “abbreviated” search output that just lists the files in the database, without attempting to locate them, based on the config file Example: /home/todd/docs/1.txt /home/todd/docs/2.txt Another possibility (based on a configuration file format) would be to have a user-defined output, for example: file status dbfunction --> might yield /home/todd/docs/hi.txt not found retained Update function should delete/retain unfound items based on the configuration file, and send output to stdout. Questions Should we use threads to try to locate files that aren’t in their expected position? This might screw up piping the output through “sort,” for example. To Do Don’t store the filename to process (from the command line). Rather, store the index to that value so that we can iterate over all non-option filenames