joining :\temp\pysplit to make :\temp\mypy msi join completesee :\temp\mypy msi :\tempdir msi more : am , , mypy msi : pm , , python- msi file( , , bytes dir( , , , bytes free :\tempfc / mypy msi python- msi comparing files mypy msi and python- msi fcno differences encountered the join script simply uses os listdir to collect all the part files in directory created by splitand sorts the filename list to put the parts back together in the correct order we get back an exact byte-for-byte copy of the original file (proved by the dos fc command in the codeuse cmp on unixsome of this process is still manualof course ( never did figure out how to script the "walk the floppies to your bedroomstep)but the split and join scripts make it both quick and simple to move big files around because this script is also portable python codeit runs on any platform to which we cared to move split files for instancemy home computers ran both windows and linux at the timesince this script runs on either platformthe gamers were covered before we move onhere are couple of implementation details worth underscoring in the join script' codereading by blocks or files first of allnotice that this script deals with files in binary mode but also reads each part file in blocks of kb each in factthe readsize setting here (the size of each block read from an input part filehas no relation to chunksize in split py (the total size of each output part fileas we learned in this script could instead read each part file all at onceoutput write(open(filepath'rb'read()the downside to this scheme is that it really does load all of file into memory at once for examplereading mb part file into memory all at once with the file object read method generates mb string in memory to hold the file' bytes since split allows users to specify even larger chunk sizesthe join script plans for the worst and reads in terms of limited-size blocks to be completely robustthe split script could read its input data in smaller chunks toobut this hasn' become concern in practice (recall that as your program runspython automatically reclaims strings that are no longer referencedso this isn' as wasteful as it might seemsorting filenames if you study this script' code closelyyou may also notice that the join scheme it uses relies completely on the sort order of filenames in the parts directory because it simply calls the list sort method on the filenames list returned by os listdirit implicitly requires that filenames have the same length and format when created complete system programs