Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete unused images in a rails project
images = Dir.glob('public/images/*')
images.each do |image|
unless File.directory?(image)
puts "Checking #{image}..."
if IO.popen("ack-grep -1 -G '(app|public)' --ruby --html --css #{File.basename(image)}").eof?
IO.popen("svn delete #{image}")
puts " Deleted"
end
end
end and nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.