When the server script is published, if it is divided, there are more than one server, update a script, copy and paste, very troublesome, write a script automatically released, and then hot update can be recorded after the use of
import OS;
Import Os.path;
Import Shutil;
Def CopyFiles (SourceDir, TargetDir):
for files in Os.listdir (sourcedir):
sourcefile = Os.path.join (SourceDir, files);
TargetFile = Os.path.join (targetDir, files);
If Os.path.isfile (sourcefile) and Sourcefile.find ('. Lua '):
tmpstr = ' cp%s '% (sourcefile, targetfile);
Print (TMPSTR);
Shutil.copy (SourceFile, targetfile);
if __name__ = = ' __main__ ':
copyfiles ('/home/luafile ', '/home/buyugameserver/lua ');
CopyFiles ('/home/luafile ', '/home/buyu2/lua ');
CopyFiles ('/home/luafile ', '/home/buyu3/lua ');
CopyFiles ('/home/luafile ', '/home/buyu4/lua ');
CopyFiles ('/home/luafile ', '/home/buyu5/lua ');
Upload the script to be updated to the/home/luafile directory, then Python3 copy_lua.py can automatically copy