Skip to content

Instantly share code, notes, and snippets.

@sasasin
Created October 7, 2012 07:51
Show Gist options
  • Save sasasin/3847468 to your computer and use it in GitHub Desktop.
Save sasasin/3847468 to your computer and use it in GitHub Desktop.
JUSTIO ADS2500Wで作成したファイル名を、lsしたときページ順に並ぶよう、リネームするコマンドです。
#!/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