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

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 files in the current directory with the following extensiions:

      .asf  .jpeg .mov  .mts  .tif 
      .avi  .jpg  .mp4  .png  .tiff

and their uppercase versions. The extensions are converted to 3 lowercase characters (like JPEG → jpg, tiff → tif). The base names are converted to the format yyyymmdd-hhmmss as reported by exiftool, using its -datetimeoriginal, -createdate, or -gpsdatetime options, in that order. If renaming would generate an existing filename, an extra character a-z is added. Files which lack date/time information in their metadata will be renamed to 101.xxx, 102.xxx, ... Base names that are already in that format are skipped here, unless you use the --all option. When one or more files don’t contain date/time information in their metadata, you get a warning and you are asked to make a decision about what to do with them:

1. go on 2. go on but set basename of dateless files in metadata title 3. skip dateless files 4. do nothing

 

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
globals used:
BASH_VERSINFO

handle_options

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

finddate

synopsis:
finddate arg
description:
finddate tries, with exiftool‘s -date options, to find the
creation date of the photo given in the argument. The date found is reported in the format dddddddd-dddddd. If no date is found, reports an empty line.
globals used:
none

exists

synopsis:
exists targetname
description:
test if targetname already exists as a value in fromto array
globals used:
fromto

mkuniq

synopsis:
mkuniq from to-base  to-ext
description:
set the value of fromto[$1] to $2.$3
globals used:
Myname Version