Skip to content

Instantly share code, notes, and snippets.

@diecrf
Created August 25, 2011 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save diecrf/1170410 to your computer and use it in GitHub Desktop.
Save diecrf/1170410 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