Skip to content

Instantly share code, notes, and snippets.

@tosbourn
Created February 13, 2013 22:41
Show Gist options
  • Save tosbourn/4949062 to your computer and use it in GitHub Desktop.
Save tosbourn/4949062 to your computer and use it in GitHub Desktop.
require 'FileUtils'
homepath = File.expand_path "~"
desktop_files = Dir.entries homepath + "/Desktop"
desktop_files.to_a
screen_shot_folder = homepath + "/Desktop/Screenshots"
Dir::mkdir(screen_shot_folder) unless File.exists?(screen_shot_folder)
desktop_files.each {
|the_file|
if the_file.include? "Screen Shot"
old_file = homepath + "/Desktop/" + the_file
new_file = screen_shot_folder + "/" + the_file
FileUtils.mv(old_file,new_file, :force => true)
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment