from Tips-HOWTO
______________________________________________________________________
#!/bin/sh
# lowerit
# convert all file names in the current directoryto lower case
# only operates on plain files--does not changethe name of directories
# will ask for verification before overwriting anexisting file
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done
______________________________________________________________________
看看,多看看HOWTO多好啊
【 在 jgsun (jgsun) 的大作中提到: 】
: #!/bin/ksh
: [ "$1" = "" ] && {
: echo Usage: tolower file_or_dir_list
: exit 1
: }
: find $* -depth -name "*[A-Z]*" -print | while read src ; do
: prefix=${src%/*}/
: base=${src##*/}
: [ "$src" = "$base" ] && prefix=
: dst="$prefix"`echo "$base" | tr "A-Z" "a-z"`
: [ "$src" = "$dst" ] && {
: echo $file already is a lower case file name
: continue
: }
: [ -e "$dst" ] && {
: echo $file already exist, $src not changed
: continue
: }
: echo Processing $src
: mv "$src" "$dst"
: done