Linux

Rename AVCHD files using Exiftools

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_%%f.%%e “$x” done The resulting files will be named like YYYYMMDD_HHMM_BASENAME.ext ie 20120703_1635_05600.MTS […]

Read More
Linux

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 :)

Read More
Scripting

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’ {} \;

Read More