土曜日, 1月 10, 2015

Linux 特定のディレクトを除くディレクトリ配下のファイルの拡張子を変更する

カレントディレクトリで foo という文字列を含むディレクトリを除くディレクトリ配下のindex.htmlをindex.html.orgに変更する場合

$ find . -path "./*foo*" -prune -o -type f -name "index.html" | perl -nle '$o=$_;s/\.html$/\.html\.org/;rename $o,$_'

0 件のコメント: