Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
iOS の網膜インジケータ (@2x) を削除するために、bash コマンドまたはスクリプトで大量のファイルの名前を変更するにはどうすればよいですか?
すでにサイズを変更しましたが、サイズ変更ソフトウェアは出力ファイルの名前を変更するのが賢明ではありません。
Bash は、${var/}構文を使用した置換を提供します。例:の出現箇所を に置き換え${i/AAAA/BBBB}ます。したがって、一致するすべてのファイルをループして、それぞれの名前を変更します。AAAA$iBBBB*@2x.*
${var/}
${i/AAAA/BBBB}
AAAA
$i
BBBB
*@2x.*
for i in *@2x.*; do mv "$i" "${i/@2x/}" done