Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created June 7, 2014 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/2c27e9f6c83bace69cad to your computer and use it in GitHub Desktop.
Save hyuki0000/2c27e9f6c83bace69cad to your computer and use it in GitHub Desktop.
31foo.eps → 10foo.eps のようにファイル名変換するシェルスクリプトを生成するRubyスクリプト
# 31foo.eps → 10foo.eps
# 35baa.eps → 30baa.eps
# のようにファイル名変換するシェルスクリプトを生成するRubyスクリプト
MAP = {
'31' => '10',
'32' => '10',
'33' => '20',
'34' => '20',
'35' => '30',
'36' => '30',
'37' => '40',
'38' => '40',
'39' => '50',
'40' => '50',
}
Dir.glob("*.eps") do |eps|
if eps.match(/(\d\d)(.*.eps)/)
puts "mv -i #{$1}#{$2} #{MAP[$1]}#{$2}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment