Somehow it turned out that 20GB of photos accumulated in a non-sorted form on the home file. Moreover, if recently I and my daughter are using EOS Utility and it neatly folds the photos by year / month / day, then all the photos earlier and from other cameras simply fell into different subdirectories. Accordingly, I wanted to comb this mess, for which the following was done:
1. Installed exifprobe package (It reads information about
EXIF )
2. Written script sort_by_exif_date.sh:
#! / bin / bash
if [-f "$ {1}"]
then
CurrDate = `/ usr / bin / exifprobe -L" $ {1} "| awk 'BEGIN {DateTime = ""} / DateTime / {DateTime = $ 3} END {print DateTime}' | sed s / \ '// g`
ToPath = `echo ./${CurrDate}/ | sed 's /: / \ // g'`
if ["$ CurrDate" = ""]
then
ToPath = "./ Unknown /"
fi
mkdir -p $ {ToPath}
mv "$ {1}" $ {ToPath}
Cmd = "" $ {1} "To $ {ToPath}"
echo $ {Cmd}
fi
')
3. Launched this:
find. -path "./20071234567890]" -prune -o -exec ~ / bin / sort_by_exif_date.sh {} \;
4. And empty directories were cleaned (only empty ones were deleted):
find. -type d -exec rmdir "{}" \;
As a result, all the photos that had exif information, decomposed into daddy, all unidentified fell into the folder Unkonown.
Thus, about the good% USERNAME%, I reduced the measure of Chaos on one single file dump.