Skip to content

Instantly share code, notes, and snippets.

@unicornrainbow
Created January 6, 2011 17:29
Show Gist options
  • Save unicornrainbow/768223 to your computer and use it in GitHub Desktop.
Save unicornrainbow/768223 to your computer and use it in GitHub Desktop.
Archive and junk old entres littering your directory.
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