Skip to content

Instantly share code, notes, and snippets.

@vquaiato
Created January 4, 2012 14:03
Show Gist options
  • Select an option

  • Save vquaiato/1560190 to your computer and use it in GitHub Desktop.

Select an option

Save vquaiato/1560190 to your computer and use it in GitHub Desktop.
baixando todas as imagens dos posts importados do wordpress
Dir.foreach("../_posts/") do |file|
p "started #{file}"
begin
content = File.read("../_posts/#{file}")
images_found = content.scan /http\S*\.jpg|gif|png/i
images_found.each do |img|
system "curl #{img} -O"
p "image saved: #{img}"
end
p "ended #{file}"
rescue
p "shit #{file}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment