
/home/DB_home の下にあるすべてのファイルの名前を変更します (再帰的)
DB_homeの下にあるすべてのファイルは.txt拡張子で名前が変更されます。
例
変更前
/home/DB_home/hg/ir/qemu-ga
/home/DB_home/td/glusterfs
/home/DB_home/yr/ew/sd/cv/ntpstats
/home/DB_home/yr/ew/sd/cv/proc.csv
/home/DB_home/td/GF.conf
/home/DB_home/td/tool.bin
例(名前変更後)
/home/DB_home/hg/ir/qemu-ga.txt
/home/DB_home/td/glusterfs.txt
/home/DB_home/yr/ew/sd/cv/ntpstats.txt
/home/DB_home/yr/ew/sd/cv/proc.csv.txt
/home/DB_home/td/GF.conf.txt
/home/DB_home/td/tool.bin.txt
.
.
.
find と mv を使ってどうやってやるのですか?
答え1
こんな感じです:
find . -type f -exec mv {} {}.txt \;
答え2
find . type f -exec mv {} {}.txt \;
... 少なくとも を使用し、 を使用しない{}
限り、コマンド内で を 1 回しか使用できないという規定はないからです。;
+