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.
写真でいっぱいのディレクトリがあります。まあ言ってみれば
/usr/pics/foo /usr/pics/duckface.jpg usr/pics/bar.bmp ...
調べて名前を変更したいと思います
/usr/pics/pic1 /usr/pics/pic2 /usr/pics/pic3 ...
スクリプトsedから実行できるものである必要はありません。bash何を置き換えればいいのかわからない正規表現を処理できると思います。
sed
bash
ディレクトリ内のすべてのファイルは画像であり、拡張子やファイルの種類を気にせずにすべてのファイルの名前を変更したいと考えています。次に試してください:
for f in /usr/pics/*; do ((i++)); mv "$f" "${f%/*}/pic${i}"; done