* ianseeks <ianseeks@btinternet.com> [07-13-16 08:02]:
On Wednesday, 13 July 2016 07:55:35 BST Patrick Shanahan wrote:
* ianseeks <ianseeks@btinternet.com> [07-13-16 07:38]:
HI
Has anyone found an easy to use tool/script to update a photo file creation date/time to the date/time that the photo was taken? I'm having to change all my girlfriends' photos taken on her phone that are backed up to Windows 7 (ugh) and then transferred via samba into the digikam system.
I *assume* you mean making the file date/time match the exif file creation time which *should* match the date/time taken???
exiftool or exiv2 will accomplish this. I prefer exiv2 as it is compiled and much quicker as exiftool is a perl "script".
I do: exiv2 -T ./*.{nef,jpg}
you might change to: exiv2 -T ./*.jpg
changes the file date/time to match the exif image creation date/time w/o changing the file name.
I go further and change the image file name to match creation date/time: exiv2 mv \-k \-r %y%m%d_%H%M%S_:basename: \.\/*.{nef,jpg}'
results: 160713_075208_dsc9817.jpg YYMODA HHMMSS orig_file_name
I have quite an extensive collection over the last ~12 years, mostly sporting events (youth soccer), ~70000 the last four years in darktable.
Thanks Patrick, that looks the ticket. I shall go and give a spin now.
I go one step further, windoz upper-cases most filenames, I include lowercasing the filename in the same renaming steps above: <script.........> #!/bin/sh # lowercase_filenames - a shell script to convert filenames to lower case # underscore_filenames - a shell script to change blanks to underscores # Author: Christian Steinruecken <cstein@suse.de> # self=`basename $0` force="" verbose="" convert() { x="$1" # convert to lowercase case $self in lowercase_filenames) newname=`echo "$x" | tr '[A-Z]' '[a-z]'` ;; underscore_filenames) newname=`echo "$x" | tr '[:blank:]' '_'` esac if [ ! "$x" = "$newname" ]; then # preserve time stamp realdate=`date +%Y%m%d%H%M.%S -r "$x"` # this is required on VFAT partitions [ -n "$verbose" ] && echo "$x -> $newname" mv -i "$x" "${newname}__N_E_W__" mv -i "${newname}__N_E_W__" "${newname}" # restore time stamp touch -m -t "${realdate}" "${newname}" fi } alpha() { y="$1" b=`basename "$1"` if [ -e "$y" ]; then if [ "$force" = "1" ]; then convert "$y" else if [ "$b" = "Makefile" -o "$b" = "Mail" ]; then echo "$self: $y: Cowardly refusing to convert this (use --force)..." >&2 elif [ ! -f "$y" -a ! -d "$y" ]; then echo "$self: $y: Special file, skipping..." >&2 else convert "$y" fi fi else echo "$self: $y: No such file or directory." >&2 fi } show_help() { echo "Usage: $self [options] [files...]" case $self in lowercase_filenames) echo "Converts filenames to lowercase." echo "Options must be specified BEFORE the files." ;; underscore_filenames) echo "Converts blanks in filnames to underscores." esac echo "If no files are given, all files in the current working directory will be" echo "used. Options include:" echo echo " -v, --verbose Verbose operation" if [ $self == lowercase_filenames ]; then echo " -f, --force Also convert Makefiles, hidden and special files" fi echo " -h, --help Display this help" echo } while [ -n "$1" ]; do case "$1" in "-h"|"--help") show_help; exit 0 ;; "-f"|"--force") force="1"; shift ;; "-v"|"--verbose") verbose="1"; shift ;; *) break ;; esac done if [ -n "$*" ]; then # convert all files (given as parameters) for i in "$@"; do alpha "$i" done else # take all files in current working directory if [ -n "$force" ]; then for i in .* *; do alpha "$i" done else for i in *; do alpha "$i" done fi fi exit 0 </script........> -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://linuxcounter.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org