output open(tofile'wb'parts os listdir(fromdirparts sort(for filename in partsfilepath os path join(fromdirfilenamefileobj open(filepath'rb'while truefilebytes fileobj read(readsizeif not filebytesbreak output write(filebytesfileobj close(output close(if __name__ ='__main__'if len(sys argv= and sys argv[ ='-help'print('usejoin py [from-dir-name to-file-name]'elseif len(sys argv! interactive true fromdir input('directory containing part files'tofile input('name of file to be recreated'elseinteractive false fromdirtofile sys argv[ :absfromabsto map(os path abspath[fromdirtofile]print('joining'absfrom'to make'abstotryjoin(fromdirtofileexceptprint('error joining files:'print(sys exc_info()[ ]sys exc_info()[ ]elseprint('join completesee'abstoif interactiveinput('press enter key'pause if clicked here is join in progress on windowscombining the split files we made moment agoafter running the join scriptyou still may need to run something like zipgzipor tar to unpack an archive file unless it' shipped as an executablebut at least the original downloaded file is set to go++ :\temppython :\pp \system\filetools\join py -help usejoin py [from-dir-name to-file-name+it turns out that the zipgzipand tar commands can all be replaced with pure python code todaytoo the gzip module in the python standard library provides tools for reading and writing compressed gzip filesusually named with gz filename extension it can serve as an all-python equivalent of the standard gzip and gunzip command-line utility programs this built-in module uses another module called zlib that implements gzip-compatible data compressions in recent python releasesthe zipfile module can be imported to make and use zip format archives (zip is an archive and compression formatgzip is compression scheme)and the tarfile module allows scripts to read and write tar archives see the python library manual for details splitting and joining files