Improved rphoto.
This commit is contained in:
parent
fa878851eb
commit
889a65a45d
|
@ -17,11 +17,10 @@ checkcommand()
|
|||
|
||||
help()
|
||||
{
|
||||
echo "Usage: tphoto [-n] [ -h | -f ] [ *.jpg ]"
|
||||
echo "Usage: tphoto [ -h | -f ] [ *.jpg ]"
|
||||
echo "Rename jpg files using Exif Original Date/Time if exists."
|
||||
echo " -h Display help."
|
||||
echo " -f Force rename jpg files with Exif datetime or file datetime."
|
||||
echo " -n Dry run."
|
||||
}
|
||||
|
||||
doRename()
|
||||
|
@ -35,7 +34,11 @@ doRenameCarefully()
|
|||
{
|
||||
local filename=$(basename $1)
|
||||
#echo "$filename"
|
||||
if [[ $(exiftool $filename | grep -c "Date/Time Original") > 0 ]]; then
|
||||
if [[ $filename =~ IMG[12][90][0-9][0-9][01][0-9][0-3][0-9][012][0-9][0-5][0-9][0-5][0-9].* ]]; then
|
||||
local target=${filename:0:11}-${filename:11}
|
||||
echo "$filename -r> $target"
|
||||
mv -f "$filename" "$target"
|
||||
elif [[ $(exiftool $filename | grep -c "Date/Time Original") > 0 ]]; then
|
||||
#echo "yop $filename"
|
||||
doRename "$filename"
|
||||
else
|
||||
|
@ -53,7 +56,6 @@ else
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
find . -maxdepth 1 -type f -iname "*.jpg" | while read path
|
||||
|
|
Loading…
Reference in New Issue