Adding some extra switches
"Paul Chambers" <[email protected]> Sat, 16 Nov 2002 13:42:47 -0800
| Newsgroups | gmane.mail.ifile.devel |
|---|---|
| Message-ID | <001301c28db9$1aa2d3a0$6501a8c0@elroy> |
I'm in the process of incorporating some additional command line switches. This was motivated from wanting to be able to pipe a list of filenames (specifically the output of 'find') into ifile, and have it insert them. I currently have implemented '-z', which is like '-i' but adds filenames from stdin (and doesn't require a folder name), and '-n <n>' which extracts the n'th directory element from the files path as the folder name, counting in reverse from the file (i.e. '1' would extract the file's parent, '2' the file's grandparent, '3' the file's great-grandparent, etc). Now I'm able to write command lines like: find <my maildir> <some criteria> -type f -path '*/cur/*' | /usr/local/bin/ifile -z -n 2 And it'll insert the files that meet <some criteria>, using the maildir's name as the folder name. I'm planning to use it in a cron job with date criteria, so it will incrementally add new files. I think these additions may be useful to others, so once I'm happy with it, anyone object if I contribute it back? It would be cleaner I tweaked the existing command line options a little - like allowing '-i' to have its folder parameter omitted if '-n' was being used, for example. I can then just turn '-z' into a pure 'add files from stdin' switch. '-z' isn't very mnemonic either, but there aren't many alpha characters left :-) Paul (just registered as 'bod' on Savannah)