#!/bin/gawk -f # # LowerFiles.gawk # # Using GAWK we can strip off the file name from the full path # and rename it only when necessary (skip files that are already lowercase.) # Usage example # # find . -type f -print | ./LowerFiles.gawk | ksh # # If you skip the 'ksh' portion you can get a dry run # of the command output or redirect #
BEGIN { FS "/"; } { if ( $NF ~ /[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/ ) { printf "mv "$0" "; for (i 1; i<NF; i++) { printf $i"/"; }
RE: Write a korn shell script for renaming the filenames of the files stored in a folder to lower case.
Tested script.
#! /usr/bin/ksh echo "start" for name in `ls -1` do echo "name $name" name1 `echo $name | tr [A-Z] [a-z]`; echo "name1 $name1" mv $name $name1; if [ -z $name ] then exit; fi done