#! /usr/bin/env ruby # coding: utf-8 require "filerenamer/commander.rb" require "filerenamer/optionparser.rb" op = FileRenamer::OptionParser.new op.parse!(ARGV) fr = FileRenamer::Commander.new(op.options, ARGV) fr.execute do |filename| new_name = filename.dup new_name.gsub!('a','a'); new_name.gsub!('b','b'); new_name.gsub!('c','c'); new_name.gsub!('d','d'); new_name.gsub!('e','e'); new_name.gsub!('f','f'); new_name.gsub!('g','g'); new_name.gsub!('h','h'); new_name.gsub!('i','i'); new_name.gsub!('j','j'); new_name.gsub!('k','k'); new_name.gsub!('l','l'); new_name.gsub!('m','m'); new_name.gsub!('n','n'); new_name.gsub!('o','o'); new_name.gsub!('p','p'); new_name.gsub!('q','q'); new_name.gsub!('r','r'); new_name.gsub!('s','s'); new_name.gsub!('t','t'); new_name.gsub!('u','u'); new_name.gsub!('v','v'); new_name.gsub!('w','w'); new_name.gsub!('x','x'); new_name.gsub!('y','y'); new_name.gsub!('z','z'); # new_name.gsub!('A','A'); new_name.gsub!('B','B'); new_name.gsub!('C','C'); new_name.gsub!('D','D'); new_name.gsub!('E','E'); new_name.gsub!('F','F'); new_name.gsub!('G','G'); new_name.gsub!('H','H'); new_name.gsub!('I','I'); new_name.gsub!('J','J'); new_name.gsub!('K','K'); new_name.gsub!('L','L'); new_name.gsub!('M','M'); new_name.gsub!('N','N'); new_name.gsub!('O','O'); new_name.gsub!('P','P'); new_name.gsub!('Q','Q'); new_name.gsub!('R','R'); new_name.gsub!('S','S'); new_name.gsub!('T','T'); new_name.gsub!('U','U'); new_name.gsub!('V','V'); new_name.gsub!('W','W'); new_name.gsub!('X','X'); new_name.gsub!('Y','Y'); new_name.gsub!('Z','Z'); # new_name.gsub!('0','0'); new_name.gsub!('1','1'); new_name.gsub!('2','2'); new_name.gsub!('3','3'); new_name.gsub!('4','4'); new_name.gsub!('5','5'); new_name.gsub!('6','6'); new_name.gsub!('7','7'); new_name.gsub!('8','8'); new_name.gsub!('9','9'); # new_name.gsub!('!', '!'); new_name.gsub!('"', '”'); new_name.gsub!('#', '#'); new_name.gsub!('$', '$'); new_name.gsub!('%', '%'); new_name.gsub!('&', '&'); new_name.gsub!("'", '’'); new_name.gsub!('(', '('); new_name.gsub!(')', ')'); new_name.gsub!('*', '*'); new_name.gsub!('+', '+'); new_name.gsub!(',', ','); new_name.gsub!('-', '-'); new_name.gsub!(':', ':'); new_name.gsub!(';', ';'); new_name.gsub!('<', '<'); new_name.gsub!('=', '='); new_name.gsub!('>', '>'); new_name.gsub!('?', '?'); new_name.gsub!('@', '@'); new_name.gsub!('[', '['); new_name.gsub!("\\", '\'); new_name.gsub!(']', ']'); new_name.gsub!('^', '^'); new_name.gsub!('_', '_'); new_name.gsub!('`', '`'); new_name.gsub!('{', '{'); new_name.gsub!('|', '|'); new_name.gsub!('}', '}'); new_name.gsub!('~', '〜'); #new_name.gsub!('/', '/'); #new_name.gsub!('.', '.'); # new_name.gsub!(' ', '_'); new_name.gsub!(' ', '_'); # new_name.gsub!('~', '〜'); new_name.gsub!('-', '-'); # # 年号変換 while (/平成(\d\d)年/ =~ new_name) new_name.sub!( /平成(\d\d)年/, (1988 + ($1.to_i)).to_s + "年") end new_name end #if ARGV.size == 0 # fileAry = Dir.glob("*") #else # fileAry = ARGV #end # #fileAry.each do |oldName| # newName = # FileRenamer.new(oldName, newName, ProgramConfig, Time.now).checkAndGo #end