Dieses Skript fügt das Erstelldatum von Bildern dem namen Namen der Bilder hinzu.
Instructions
Schritt-fpr-Schritt-Anleitung
...
Code Block | ||
---|---|---|
| ||
sudo apt-get install exiftool |
Code Block | ||
---|---|---|
| ||
#!/bin/bash
#
# __author__ = "Carsten Rehberg"
# __copyright__ = "Copyright 2021, IT-Services Rehberg"
# __email__ = "mail@it-services-rehberg.de"
# __version__ = "0.0.1"
# __datum__ = Sa-06.02.2021-10:30:51
# __status__ = "Productive"
#
# addTimerToPhoto.sh
#
# the tool exiftool is necessary, which can installed with
# sudo apt-get install exiftool
#
# The script get the creation date and put it before the name of it.
# Files with a date in the name were ignored.
# You have to check the imageformat of the photos, The Original name begins with the image format like "DSC_" "CSC_".
IMAGEFORMAT='DSC_'
FILELIST=/tmp/pictures.tmp
ls . > $FILELIST
while read line
do
echo -n "*"
if [[ "$line" =~ ^${IMAGEFORMAT}* ]]; then
echo "yes"
TIMEFORMAT=` exiftool ${line} |grep "Create Date"|head -n 1|awk -F\ : ' {print $2 }' | sed 's/ //'|sed 's/ /_/'|sed 's/://g'`
NAME=${TIMEFORMAT}_${line}
echo "Name=${NAME}"
mv ${line} ${NAME}
fi
done < $FILELIST
rm $FILELIST
echo "Finished."
exit 0
|
...