Last active
December 14, 2015 11:58
-
-
Save eigilhs/5082670 to your computer and use it in GitHub Desktop.
Script for å laste ned alle filene fra en apache-index
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
#!/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