import wget import shutil import os def download(dir, file): path = dir + file url = "http://192.168.1.121/hdbg" + dir + file print(url) try: response = wget.download(url, out = "." + dir.replace("/", "\\")) except: print("An exception occurred") def downloadFiles(dir): try: shutil.rmtree("." + dir.replace("/", "\\")) except: pass os.makedirs("." + dir.replace("/", "\\")) download(dir, "/mapped_file") download(dir, "/rcache.bin") download(dir, "/pcache.bin") download(dir, "/free.bin") download(dir, "/cfgread.bin") download(dir, "/cfgprog.bin") download(dir, "/cfglookahead.bin") download(dir, "/filecache.bin") download(dir, "/log.txt") downloadFiles("/read/before") downloadFiles("/read/after") downloadFiles("/write/before") downloadFiles("/write/after") print("end")