NexuS 21 Posted October 29, 2014 Share Posted October 29, 2014 Hi Guys So, I saw a script which is delete *.py *.mix ... the bad files in the game folder. I thought about it and created a script which check ALL FOLDER AND ALL FILES CURRENT DIRECTORY and compare WITH A PATCHLIST. Let's check: ########################## ###>>>coded by Nexus<<<### ########################## import urllib.request import os import threading repeattime = 2 url = 'http://exapmle.com/patcher/patchlist.txt' backslash = '' curdir= (os.getcwd()) #the web list response = urllib.request.urlopen(url) data = response.read() # a `bytes` object text = data.decode('utf-8') # a `str`; this step can't be used if data is binary lines = text.split('n') protectedfiles = [line.strip() for line in lines] for x in protectedfiles: gfullfile= (curdir + backslash + x.split(';')[0]) protectedfiles [protectedfiles.index(x)] = gfullfile # ##ha-ha-ha #save your self by the self-delete or the usr config files protectedfiles.append(curdir + backslash + "config.cfg") allcurrentfile=[] def again(): for path, subdirs, files in os.walk(curdir): for name in files: onefile = (os.path.join(path, name)) if onefile not in protectedfiles: os.remove(onefile) threading.Timer(repeattime, again).start() again() protectedfiles.append(curdir + backslash + "CONFIG.CFG") this is necessary, because this file created by the config.exe , and this file storage the like the sound volume, screen resolution. (you couldn't patching this file) so the script is check the files by the patchlist, my patchlist look as: excxy.pyc;0c1759a0 etcyx.py;e626408e THE FILE + HASH (in between ';') you change the patchlist url here: url = 'http://exapmle.com/patcher/patchlist.txt' and the repeattime means the how often repeat the checking. the script DELETE the file if it doesn't listed. HUH, don't be afraid ,not long. 3 Link to comment Share on other sites More sharing options...
kimameixede 6 Posted July 8, 2015 Share Posted July 8, 2015 how can i use this? Link to comment Share on other sites More sharing options...
Terkea 13 Posted August 10, 2015 Share Posted August 10, 2015 can someone help me with that script? Link to comment Share on other sites More sharing options...
berseker 0 Posted November 28, 2015 Share Posted November 28, 2015 Only one question.. import urllib.request where i can find this lib? Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19680 Posted November 28, 2015 Honorable Member Share Posted November 28, 2015 This script was written by Python 3.x.x, not compatible with 2.x.x if you do not rewrite the network codes. Link to comment Share on other sites More sharing options...
Recommended Posts