Created
October 7, 2012 07:51
-
-
Save sasasin/3847468 to your computer and use it in GitHub Desktop.
JUSTIO ADS2500Wで作成したファイル名を、lsしたときページ順に並ぶよう、リネームするコマンドです。
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
#!/bin/sh | |
ls "$@" | while read f; do | |
BEFORE_NAME=$f | |
AFTER_NAME=$(ls $f | awk 'BEGIN{FS="_"}{print "$0" $1 "." $2 "." $3}' | awk 'BEGIN{FS="."}{printf("HOGE.%s.%05d.jpg\n",$2,$3)}') | |
mv $BEFORE_NAME $AFTER_NAME | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment