Skip to main content

Posts

Showing posts from September, 2014

Rename multiple files in subdirectories from uppercase, lower case or mixed case to Proper title case names

I often find large libraries of files specially Music collected from here and there and has names in various forms and specially when all in UPPERCASE it just fills up your player display and becomes annoying. I have written a quick bash script to rename any file names in any level of subdirectories to the Proper title case so anything with "File Name.TXT" or FILE NAME.TXT" or "filE NaME.tXt" will simply be renamed to "File name.txt". Simply copy paste below script in a script file and run the file in Linux bash console. If you are using Windows you can install Cygwin utility to provide you unix type access from your windows system. #!/bin/bash DIR="$1" # failsafe - fall back to current directory [ "$DIR" == "" ] && DIR="." # save and change IFS  OLDIFS=$IFS IFS=$'\n' # read all file name into an array fileArray=($(find $DIR -type f)) # restore it  IFS=$OLDIFS # get length