Skip to content

Instantly share code, notes, and snippets.

Last active December 14, 2015 11:58
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)
os.system('curl -O ' + root + m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment