2017-08-12 14 views
0

私は、ディレクトリとファイルがLinuxを使用してファイル名を再帰的に変更しますか?

/Folder/A/12_My_This.docx 
/Folder/A/12_My_Namespace.docx 
/Folder/A/12 QW Blah.docx 
/Folder/A/12 QW BlahBlah.docx 
/Folder/B/12_My_Annoying.docx 
/Folder/B/12_My_Were.docx 
/Folder/B/12 QW Stack.docx 
/Folder/B/12 QW Overlow.docx 
... 

どのようにできるようになっているはず私は3ER_My_

を含むすべてのファイルの名前を変更したいこの

/Folder/A/12 3ER This.docx 
/Folder/A/12 3ER Namespace.docx 
/Folder/A/12 QW Blah.docx 
/Folder/A/12 QW BlahBlah.docx 
/Folder/B/12 3ER Annoying.docx 
/Folder/B/12 3ER Were.docx 
/Folder/B/12 QW Stack.docx 
/Folder/B/12 QW Overlow.docx 
... 

のように見えるのディレクトリやファイルを持っています私はLinuxでこれを行うのですか?

+0

[unix.se] SEまたは[SuperUser](https://superuser.com/)には、ソフトウェアの書き方に関する質問ではなく、オペレーティングシステムの使用方法に関する質問が適しています。それは、あなたが[BashFAQ#30](http://mywiki.wooledge.org/BashFAQ/030)が興味のあるものであるかもしれないと言った。それが示すものとあなたが必要とするものの唯一の違いは、別の[パラメータ拡張](http://wiki.bash-hackers.org/syntax/pe)の使用です。 –

+0

これはおそらく[検索+ファイル名の文字列の置換](https://stackoverflow.com/questions/7171659/searchreplace-strings-in-filenames)と重複しています。 –

答えて

1
find . -name '* 3ER *' -print0 | while IFS= read -r -d '' filename; do 
    mv -- "$filename" "${filename// 3ER /_My_}" 
done 
関連する問題