renamefotos rename all image/movie files in current dir by date/time
doc generated from the script with gendoc
bash script, version=1.02

Synopsis

renamefotos [options]

Options

-h,--help
print this help and exit
-H,--Help
print full documentation via less and exit
-V,--version
print version and exit
-f,--force
rename even if some files have no creation date
-d,--dry
do a dry run, i.e. don´t actually rename files

Description

renamefotos renames all .jpg, .jpeg, .tif, .tiff,.mov, .asf, .mts, and .avi files in the current directory, using the creation date as reported by exiftool, using its -createdate, -gpsdatetime, and -␣datetimeoriginal␣options,␣in␣that␣order.␣No␣file␣is␣renamed␣if␣any␣of␣the␣files does not contain a date, as that would change file order. Upper case extensions are converted to lower case, jpeg is converted to jpg.

The new name is will have the format yyyymmdd-hhmmss, with the extension of the original converted to lower case. If renaming would generate an existing filename, an extra character a-z is added.

Author

Wybo Dekker

Copyright

Released under the GNU General Public License

Functions used:


excheck

synopsis:
excheck executable1 [executable2...]
description:
check if all needed execs are there and getopt is GNU

handle_options

synopsis:
handle_options "$@"
description:
handle the options.
globals used:
Myname Version

exists

synopsis:
handle_options "$@"
description:
handle the options.
globals used:
Myname Version

rename

synopsis:
rename arg1 arg2
description:
renames arg1 to arg2, unless the --dry option was used,
and then reports this operation
globals used:
Myname Version dry

renameall

description:
loops through the associative array fromto and renames each
key to the corresponding value
globals used:
Myname Version fromto

finddate

synopsis:
finddate arg
description:
finddate tries, with exiftool‘s -creationdate option,
to find the creation date of the file given in the argument. If that is not found, it tries the -gpsdatetime and -datetimeoriginal options. The date found is reported in the format dddddddd-dddddd. If no date is found, reports an empty line.
globals used:
Myname Version