Last active
May 19, 2020 04:46
-
-
Save Cj-bc/308553b7a35b18728dfbd5f30c5e185f to your computer and use it in GitHub Desktop.
画像の横幅で連番リネームするスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Require bash, imagemagick, awk | |
# THIS IS NOT TESTED; USE ON YOUR OWN RESPONSIVILITY | |
# テストされていません(動作確認していません)。自己責任で使ってください。 | |
# 使い方: こいつに実行権限与えて `./rename.sh <ファイル1> <ファイル2> ...` | |
# もしくは $@の部分をファイル名に置き換えればいい | |
# 画像ファイルが保存されているディレクトリで実行してください。違うディレクトリのファイルを指定した場合、実行後、カレントディレクトリにファイルが移動します。 | |
identify -format "%w %f\n" $@ | sort | awk 'BEGIN {i=0} {suffix="."sub(".*\\.", "", $2); print "mv", $2, i++suffix}' | xargs -L1 eval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment