Created
November 25, 2011 02:37
-
-
Save nuna/1392687 to your computer and use it in GitHub Desktop.
指定したディレクトリ以下の特定のファイルを再帰的にリネーム
This file contains hidden or 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
#!/usr/bin/ruby | |
require 'find' | |
require 'fileutils' | |
dir = ARGV.shift | |
Find.find(dir) do |f| | |
if File.file?(f) and /20111123.*\.xls$/ =~ f | |
FileUtils.mv(f, f.sub(/20111123/, '20111124'), { :noop => false, :verbose => true }) | |
end | |
end | |
# > ruby rename.rb <dirname> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment