A while back I was unfortunate in such a way that my HDD that I primarily use as photo archive started having mechanical issues, and before It died on my arms I had the opportunity to backup most of my pictures, however most of them were truncated and had to be discarded and the ones I could recover their filenames where overwritten with random filenames and ascii codes.
For over a while I have neglected my pictures and they just piled up in a single and nameless directory, until I took it against myself to clean them up.
And one of the benefits of using Linux OS is the scripting features.
[code language="bash"]
for i in *;
do d=$(exiftool $i | grep 'Date/Time Original' | cut -f 17 -d ' ');
newd=`echo ${d//:/-}`;
echo $i ${newd} ;
mkdir -p ${newd};
mv -- ${i} ${newd};
done
[/code]
- write this script to a file named
mvByDate.sh
in your old directory. - replace the
/your/new/directory
with your new directory's path - make this file executable with
chmod +x mvByDate.sh
- then execute this file by
./mvByDate.sh
- voila