Skip to content

Instantly share code, notes, and snippets.

@eigilhs
Last active Dec 14, 2015
Embed
What would you like to do?
Script for å laste ned alle filene fra en apache-index
#!/usr/bin/env python
import os, re, sys, urllib
magic_key = r'</td><td><a href="(.+)">.+</a>.*</td><td align="right">'
def mine(root):
for line in urllib.urlopen(root):
for m in re.findall(magic_key, line):
if m != 'Parent Directory':
if m.endswith('/'):
mine(root + m)
else:
os.system('curl -O ' + root + m)
mine(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment