rcanzlovar.com

Changing image names using EXIF tool

December 24, 2014

Changing image names using EXIF tool

exiftool and a way to rename your pictures into something sensible ExifTool is probably your best start: <http://www.sno.phy.queensu.ca/~phil/exiftool/> I second exiftool. Lots of options to rename files. If you rename files based on createtime and perhaps other fields like resolution you will end up with unique filenames and then you can filter the duplicates Here is a quick command which will rename every file in a directory according to createDate exiftool "-FileNameCreateDate" -d "%Y%m%d_%H%M%S.%%e" DIR If the files were all captured with the same device it is probably super easy since the exif info will be consistent. If the files are from lots of different sources…good luck. #!/bin/sh OUTF=rem-duplicates.sh; echo "#! /bin/sh" > $OUTF; find "$@" -type f -print0 | xargs -0 -n1 md5sum | sort --key=1,32 | uniq -w 32 -d --all-repeated=separate | sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF; chmod a+x $OUTF; ls -l $OUTF It should be straightforward to change “md5sum” to some other key – e.g. EXIF Date + some other EXIF fields. (Also, isn’t this really a question for superuser.com or similar?) Same thing, but faster… You md5sum everyfile, but you only need to do it for files with the same size: #/bin/bash find "$@" -type f -not -empty -printf "%-32i%-32s%p\n" \ | sort -n -r \ | uniq -w32 \ | cut -b33- \ | uniq -D -w32 \ | cut -b33- \ | xargs -0 -d"\n" -l1 md5sum \ | uniq --all-repeated=separate -w32 \ | cut -b35-