Created
January 6, 2011 17:29
-
-
Save unicornrainbow/768223 to your computer and use it in GitHub Desktop.
Archive and junk old entres littering your directory.
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
class Projects < Thor | |
desc 'archive', 'Archive and junk old entres littering your directory.' | |
def archive(move_to_dir = Time.now.year.to_s) | |
Dir.foreach(Dir.pwd) do |entry| | |
unless entry =~ /^\.|^[\d]{4}|#{move_to_dir}/ | |
case ask "#{entry} (move/junk) or skip: " | |
when /^m(ove)?$/ | |
FileUtils.mv entry, move_to_dir | |
when /^j(unk)?$/ | |
FileUtils.mv entry, '.junk' | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment