from os import system from sys import argv from subprocess import getoutput def get_apache_directory(URL): spot = URL.split("/")[-2] print("Spot to save stuff: " + spot) system("wget " + URL) system("mv " + "index.html" + " " + spot + ".html") system("mkdir " + spot) index_lines = open(spot + ".html").readlines() for line in index_lines: if "a href" in line and not "?C=S" in line and not "Parent Directory" in line: example_filename =line.split('"')[7] if example_filename[-1] == '/': print("We're going to use directory: ", example_filename) system("/tmp/ge " + getoutput("pwd")+"/"+spot + " " + URL + "/" + example_filename) else: system("wget " + URL + "/" + example_filename) system("mv " + example_filename + " " + spot) get_apache_directory(argv[1])