Created
December 24, 2011 00:45
-
-
Save raa0121/1515807 to your computer and use it in GitHub Desktop.
html実体参照なファイル名をリネームするスプリクト for win
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
#!/use/bin/ruby -Ks | |
#codeing:sjis | |
require 'rubygems' | |
require 'htmlentities' | |
def printDirs(dir) | |
Dir::entries(dir).sort.each do |child| | |
path = dir + "/" + child; | |
if child == "." or child == ".." | |
# do nothing | |
elsif File::ftype(path) == "directory" | |
printDirs(path, &Proc.new{|it| yield(it)}) | |
else | |
yield(path) | |
end | |
end | |
end | |
printDirs(".") do |it| | |
it2 = File::basename(it) | |
puts it2+"\n" | |
it3 = HTMLEntities.new.decode(it2).encode("Shift_JIS") | |
if it2 != "rename_file.rb" and it2!=it3 | |
File.rename(it2,it3) | |
end | |
puts it3+"\n" | |
end | |
print "Push anykey:" | |
gets.chop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment