Created
January 6, 2011 16:30
-
-
Save unicornrainbow/768121 to your computer and use it in GitHub Desktop.
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
require 'fileutils' | |
move_to_dir = ARGV[0] || Time.now.year.to_s | |
puts <<usage | |
Project Archiver | |
====================================================================== | |
Tell me what to do with each entry. Enter nothing to skip. | |
- Entries which you move will go to #{move_to_dir}. | |
- Entries which you junk will for to .junk. | |
ctrl-c to exit at any time. | |
usage | |
Dir.foreach(Dir.pwd) do |entry| | |
unless entry =~ /^\.|^[\d]{4}|#{move_to_dir}/ | |
print "#{entry} (move/junk) or skip: " | |
case gets.chomp | |
when /^m(ove)?$/ | |
FileUtils.mv entry, move_to_dir | |
when /^j(unk)?$/ | |
FileUtils.mv entry, '.junk' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment