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