Skip to content

Instantly share code, notes, and snippets.

@WillsonSmith
Created August 14, 2014 23:06
Show Gist options
  • Save WillsonSmith/6ff4e70a7832bda9994e to your computer and use it in GitHub Desktop.
Save WillsonSmith/6ff4e70a7832bda9994e to your computer and use it in GitHub Desktop.
Move screenshots from whatever directory you are currently in into a temp folder. (ie, "cd ~/desktop" "ruby ScreenShot.rb")
require 'fileutils'
files = Dir.glob "*.png"
files = files.map { |file| [file.count("?/"), file] }
files = files.sort.map { |file| file[1] }
files.each do |file|
rena = file.include? 'Screen Shot'
dchk = 'temp'
if rena
puts rena
Dir.mkdir(dchk) unless File.exists?(dchk)
FileUtils.mv(file, 'temp/')
else
puts "nope"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment