Simple bash script to rename AVCHD/MTS/MOV files to match their recording date and time. #!/bin/bash if [ -z "$1" ]; then echo “Usage: ./rename_video.sh FILETYPE” 1>&2 echo “Example: ./rename_video.sh *.MTS” 1>&2 exit 1 fi for x in “$@” do exiftool ‘-FileName<DateTimeOriginal’ -d %Y%m%d_%H%M%S_%%f.%%e “$x” done The resulting files will be named like YYYYMMDD_HHMMSS.ext ie 20120703_005600.MTS [...]
Posts Tagged: rename
Remove white space from file names
This is a one liner to remove white space in filenames using a linux console # rename ‘y/ /_/’ * You could also do this the other way, remove underscore with space # rename ‘y/_//’ *
Rename file name suffix to uppercase or lowercase
This is a little oneliner to rename a files suffix from/to uppercase/lowercase. Rename a jpg suffix to JPG in the current folder # find -name “*.jpg” | while read a; do mv “$a” “${a%%.jpg}.JPG” ; done The work JPG can be replaced by any other word :)
Rename files in a folder to lower-case using perl
This is a simple oneliner to rename files to lower-case using perl # perl -e ‘rename($_, lc) || warn “$_: $!\n” for @ARGV’ * You can also do this recusively using find and perl # find . -type f -exec perl -e ‘rename($_, lc) || warn “$_: $!\n” for @ARGV’ {} \;
Rename files by wildcard pattern and correct the EXIF timestamp metadata
This is a little script I’ve written to correct all my image files since the EXIF timestamp information is one hour out of sync. The filenames have been renamed to comply to the EXIF information and has to be renamed again because of the one hour scew. The filename can look something like this 20080102-1201_DSC_0910.JPG [...]
Recent Comments