Advertisement
cd62131

Move files

Jun 27th, 2014
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.32 KB | None | 0 0
  1. #!/use/bin/ruby
  2. # coding: utf-8
  3. require 'fileutils'
  4. require 'pathname'
  5. abort unless ARGV.size == 1
  6. base_dir = Pathname ARGV.shift
  7. base_dir.children.each do |f|
  8.   dir = Pathname "#{base_dir}/#{f.mtime.strftime '%Y年%m月%d日'}"
  9.   FileUtils::Verbose.mkdir dir unless dir.directory?
  10.   FileUtils::Verbose.mv f, dir
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement