Created
July 31, 2010 00:53
-
-
Save lucindo/501564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib, sys | |
from BeautifulSoup import BeautifulSoup | |
if __name__ == '__main__': | |
if len(sys.argv) != 2: | |
print "usage: %s <amazon s3 url>" % sys.argv[0] | |
sys.exit(1) | |
base_url = sys.argv[1] | |
xml = urllib.urlopen(base_url).read() | |
soup = BeautifulSoup(xml) | |
for content in soup.findAll("contents"): | |
if content.key.string.find("$folder$") == -1: | |
file_url = base_url + "/" + content.key.string | |
print "downloading: %s" % file_url | |
urllib.urlretrieve(file_url, content.key.string.replace("/", "_")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment