2013-03-13 10:05:48 作者:容易
#!/bin/bash
find /app/oracle/product/10.2.0/db/jdk -type f -print >/home/oracle/a
for i in `cat /home/oracle/a`
do
filename=`echo $i | awk -F '/' '{print $NF}'`
pathname=`echo $i | awk -F "$filename" '{print $1}'`
tolow=`echo $filename | tr 'A-Z' 'a-z'`
mv $i $pathname$tolow
done
python版
#!/usr/bin/python
import os
for a,b,c in os.walk('/test')
if c:
for i in c:
tolow=i.lower()
newname=a+'/'+tolow
oldname=a+'/'+i
os.rename(oldname,newname)
import os
for a,b,c in os.walk('/test')
if c:
for i in c:
tolow=i.lower()
newname=a+'/'+tolow
oldname=a+'/'+i
os.rename(oldname,newname)
One Response