Skip to content

Instantly share code, notes, and snippets.

@sasasin
Created October 18, 2012 10:23
Show Gist options
  • Save sasasin/3910894 to your computer and use it in GitHub Desktop.
Save sasasin/3910894 to your computer and use it in GitHub Desktop.
なんだかよくわからない、リネームコマンドです。
#!/bin/sh
ls *.pdf \
| grep -v '^zip2pdf\.' \
| sort \
| perl -wnl -aF'\.' -e 'print(pop(@F) . "|" . join(".", @F) . "|" . "19990104." . sprintf("%06d", $.) )' \
| awk 'BEGIN{FS="|"}{print "mv \"" $2 "." $1 "\" zip2pdf." $3 "." $1}' \
> hoge.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment