Skip to content

Instantly share code, notes, and snippets.

@WillsonSmith
Created October 29, 2013 04:19
Show Gist options
  • Save WillsonSmith/7209125 to your computer and use it in GitHub Desktop.
Save WillsonSmith/7209125 to your computer and use it in GitHub Desktop.
Move all screenshots (Mac) from desktop into a temporary (tmp) folder.
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