Jump to content

File Auto Check


Recommended Posts

Hi Guys
 
So, I saw a script which is delete 
*.py
*.mix
...
the bad files in the game folder.
I thought about it :rolleyes:  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.

 

  • Love 3
Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...
  • 3 months later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.