Skip to content

Instantly share code, notes, and snippets.

@eigilhs
Last active December 14, 2015 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eigilhs/5082670 to your computer and use it in GitHub Desktop.
Save eigilhs/5082670 to your computer and use it in GitHub Desktop.
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