荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: jjksam (Fight the Future), 信区: Linux
标 题: Re: 8.将当前目录下所有文件(包括目录)
发信站: 荔园晨风BBS站 (Thu Feb 21 16:25:29 2002), 转信
#下面这个也可以
#!/bin/bash
#this script can deal with filename contain backslash "\"
#but it can NOT change the filename in the sub directory.
for f in *; do
mv $f `echo $f | tr '[A-Z]' '[a-z]'`
done
【 在 zzt (pig) 的大作中提到: 】
#!/bin/ksh
# this script can't deal with filename contain backslash "\"
[ "$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
--
※ 修改:.zzt 于 Oct 18 16:32:34 修改本文.[FROM: 192.168.0.101]
^[[1;36m☆ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.101]
--
· .'________'. ·
[____________] ICQ:70242872 OICQ:5808373
/ / .\/. \ \ 大镬啦,佢哋杀咗碌葛!
| \__/\__/ | / 不过唔使惊啵,下一集佢会返生嘎:)
\ /
· /'._ ○ _.'\ ·
※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 61.144.235.41]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店