Skip to content

Instantly share code, notes, and snippets.

@hswolff
Created February 19, 2012 21:12
Show Gist options
  • Save hswolff/1865810 to your computer and use it in GitHub Desktop.
Save hswolff/1865810 to your computer and use it in GitHub Desktop.
Cleanup of unwanted files
#!/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
@hswolff
Copy link
Author

hswolff commented Feb 20, 2012

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