Created
February 19, 2012 21:12
-
-
Save hswolff/1865810 to your computer and use it in GitHub Desktop.
Cleanup of unwanted files
This file contains 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
#!/usr/bin/env ruby | |
path = '/Volumes/Downloads/Cleanup/' | |
Dir.foreach(path) do |item| | |
next if item == '.' or item == '..' | |
puts item | |
item_dir = path + item | |
if File.directory?(item_dir) | |
# Inside folder | |
Dir.foreach(item_dir) do |file| | |
next if file == '.' or file == '..' | |
if file.end_with?('.nfo', '.jpg') and not file.start_with?('fanart','movie') | |
to_delete = item_dir + '/' + file | |
if File.exists?(to_delete) | |
# Un comment to actually delete | |
# File.delete(to_delete) | |
puts "Deleted: #{to_delete}" | |
end | |
end | |
end | |
end | |
end |
Hazel looks pretty cool. This was created while using Ember Media Manager. I was trying to clean up my digital movie collection. I really want to make a good OS X version of Ember MM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If this is something you're doing often, try out Hazel. I use it to keep my folders clean of junk.