Skip to content

Instantly share code, notes, and snippets.

@rgo
Forked from diecrf/gist:1170410
Created August 26, 2011 11:36
Show Gist options
  • Save rgo/1173243 to your computer and use it in GitHub Desktop.
Save rgo/1173243 to your computer and use it in GitHub Desktop.
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