#
# cfn - Capitalize File Names
# CapitalizeFileName() {
awk '{
cmde = "mv \"" $0 "\" ";
gsub(/-/," - " );
gsub(/\(.*\)/,"" );
for (i=1; i<=NF; i++)
$i = toupper(substr($i,1,1)) tolower(substr($i,2))
new_name = sprintf("\"%s\"",$0);
if (new_name != $0) {
cmde = cmde new_name;
print cmde;
system(cmde);
}
}'
}
if [ $# -ne 0 ]
then
for file; do
echo "$file"
done | CapitalizeFileName
else
CapitalizeFileName
fi |