Some people might remember my imageSorting script, which I wrote for data-recovery scenarious, in whose you end up with millions of folders or images without filenames (so nearly impossible to sort em). My imageSorting script tries to sort them by year/extension/size where as size is “large, medium, small, thumb”. Today i updated the script…
Warning: As always, you’re using scripts/software/stuff made by me, on your own risk. It’s here to try to help you, but i can’t give any warranty, responsibility or anything else.
The “problem” with version 0.5 was, that I was using ImageMagick’s “convert” to move pictures; the idea was, that after a data-recovery some pictures are broken, and convert would normalize them, like removing crap and making it possible to open them in other tools, which would otherwise refuse to open them, etc. I have no idea whether there are side effects for “not-broken” pictures. And I don’t know a way to detect whether an image is “broken” thus i was using convert for “every” image.
And at some images, convert started to hang. Thus after hours of processing 4 convert jobs might stop the whole processing due to a hang. I have currently no idea (I think I’m already at the limit of bash’s possibilities in that direction) how to check probably whether a “thread” in my script is still active or not (or.. how to add a timeout, which wouldn’t be good neither i guess).
Instead of thinking about this and creating a mess for me, i just removed the “convert” part from the Script. Instead it’s just using “cp”. Thus I’m
- sure the picture gets copied as-is
- I’m sure that time/modification dates aren’t changing (that was a problem with version 0.5 – due to the convert it changed the mod time and thus on a second run all pictures would end up in “current” year)
- there really shouldn’t be any “hang”
- it’s a lot faster.
Also.. The Script could be used now also for people who just want to try to sort their pictures from several directories.
Remember: My Script is just a “try” to help at the sorting process. You might still end up with thousands of pictures in for example: 2006/JPEG/large/ however; If you’re lucky it’ll be less and you get something like this:
wdp@kronos:~/NeueBilder$ ls 2006 2007 2008 2009 2011 wdp@kronos:~/NeueBilder/2011$ ls large medium small wdp@kronos:~/NeueBilder/2011/large$ ls JPEG TIFF
I also suggest you, to run a script which will search for copies in that folders. Especially after data-recovery you might have several pictures twice or more times. I also wrote a script for that.
Apart from that, i just fixed a few smaller bugs (there might be still some around). Like using “unknown” as foldername, instead of 0000 when a year isn’t given, improved the detection of a valid year, such stuff.
You can download the imageSorting script via this link.