|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
[PLUG] sorting by date without stat
|
I want to be able to sort my photos by date. But I might rotate them
or do other transforms that changes the modification date set by my
camera. So I typically encode the date and time of the photo in the
name of the photo. (For an example of how to do this, see my script
new-image at <http://www.purple.com/GPL/>.)
The thing is, I want the file names to have the following properties:
- start with natural language, so I never have to start by typing
numbers.
- encode the date in human readable form.
(I've got those two.)
- Allow for sorting by date, even through an eval or backtick
expression. I can't count on `ls -t`, because I might have rotated the
images or, at some distant point in the future, copied to a new file
system and accidentally lost mtime info.
I could just encode unix time, which is ok for the next thirty years
or so. But it seems cumbersome. Already I've got long files names like
jim_waterfall_buttes_chaumont__Sat-19-May-2001_14:08.jpg
I guess I could do
jim_waterfall_buttes_chaumont__990225432__Sat-19-May-2001_14:08.jpg
(I made up that mtime number. Disturbingly, I did a good job.)
It's just ugly and fails any concept of normal form. I'm wondering if
someone has a better idea. Perhaps I should just parse the trailing
date. There must be an easier way, since in the end, then, I need a
program that takes a bunch of these file names and dumps on stdout a
permutation of those names that is time sorted.
As I ask the question, I hear the answer: parse it and get over it.
--
Jeff
Jeff Abrahamson <http://www.purple.com/jeff/>
______________________________________________________________________
Philadelphia Linux Users Group - http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|