An interesting problem...
Interesting is not the word I would use first ;)
I think the find/awk solution (or, tee hee, perhaps a du -sS | awk '{print
$2}' | awk... solution) is good.
So do I, before posting I was quite sure it was the way to go, but I could not figure how to start.
In fact, it is really better: my original script reliably needs around 35 minutes to complete, the solution proposed by Stefan takes (out of the box) around 5 minutes :)
The suggestion of perl (or python or ruby) is also probably a good idea. I think it depends on what you really want to do with the output (are you going to move files around via the results?).
Yes, I'm going to move the files, depending on what I can guess about them. I was thinking in a DIGICAM/RESOLUTION/FILENAME way to store pictures, FILENAME being the exif date. Perl, python or ruby... yes, but I'd rather do it with a minimum tools, given that I need to read every man page and experiment for a few hours with standard command line utilities.
I recently tried to create a bash script that used arrays and got stymied
by (i think) bashes quoting needs. It just couldn't cope with multiple
piped commands and etc... in a for loop construct. After banging my head
for a couple hours trying all sorts of unique ways of minimizing the
quoting and etc...
I have encountered the same kind of problems :( That's why I asked for help, I'm pretty confident that things are much more simple than what I think... and usually, they are.
I realized that I would be done already in perl :) In particular, I'm thinking a 2D array would be ideal for this exercise (bye, bye bash) and then you could do what ever by sorting the (in RAM) array first and then moving files around via that or just outputting the array to a file.
If I was doing it this way, I'm sure I would spend one week or so reading about sort algorythms, or memory-usage optimization, or something like that, I'm just too complicated :(
I'm not really intending to plug Perl so badly here but there's exiftool <http://owl.phy.queensu.ca/~phil/exiftool/> which happens to be written in Perl. I think it could be extended with a custom command line option to output just the things you need in whatever way. Then again, I looked at jhead and it's not too bad, you could modify that too, they both look like they support recursive processing. I guess it depends on if you want to modify C or Perl.
I'll have a look at exiftools, thank you. Jhead is nice, yes, the renaming-according-to-exif-date and the process-depending-on-camera-model functions are just wonderfull. But I'm looking in the way of exiftags right now, which seems more "unix spirit" (ie, it has man pages ;) ).
Thank you for your feeback, It is really interresting (and educative here) to talk with you guys.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page
