...over 1,000 lines deleted...
02/21/2010 01:40 PM 10,000 part1378
02/21/2010 01:40 PM 10,000 part1379
02/21/2010 01:40 PM 10,000 part1380
02/21/2010 01:40 PM 10,000 part1381
02/21/2010 01:40 PM 4,272 part1382
1382 File(s) 13,814,272 bytes
2 Dir(s) 188,651,008,000 bytes free
Finally, the splitter is also smart enough to create the output directory if it doesn’t yet
exist and to clear out any old files there if it does exist—the following, for example,
leaves only new files in the output directory. Because the joiner combines whatever files
exist in the output directory, this is a nice ergonomic touch. If the output directory was
not cleared before each split, it would be too easy to forget that a prior run’s files are
still there. Given that target audience for these scripts, they needed to be as forgiving
as possible; your user base may vary (though you often shouldn’t assume so).
C:\temp> C:\...\PP4E\System\Filetools\split.py python-3.1.msi tempsplit 5000000
Splitting C:\temp\python-3.1.msi to C:\temp\tempsplit by 5000000
Split finished: 3 parts are in C:\temp\tempsplit
C:\temp> dir tempsplit
...more...
Directory of C:\temp\tempsplit
02/21/2010 01:47 PM <DIR>.
02/21/2010 01:47 PM <DIR> ..
02/21/2010 01:47 PM 5,000,000 part0001
02/21/2010 01:47 PM 5,000,000 part0002
02/21/2010 01:47 PM 3,814,272 part0003
3 File(s) 13,814,272 bytes
2 Dir(s) 188,654,452,736 bytes free
Of course, the dilemma that these scripts address might today be more easily addressed
by simply buying a bigger memory stick or giving kids their own Internet access. Still,
once you catch the scripting bug, you’ll find the ease and flexibility of Python to be
powerful and enabling tools, especially for writing custom automation scripts like
these. When used well, Python may well become your Swiss Army knife of
computing.
Generating Redirection Web Pages
Moving is rarely painless, even in cyberspace. Changing your website’s Internet address
can lead to all sorts of confusion. You need to ask known contacts to use the new
address and hope that others will eventually stumble onto it themselves. But if you rely
on the Internet, moves are bound to generate at least as much confusion as an address
change in the real world.
Unfortunately, such site relocations are often unavoidable. Both Internet Service Pro-
viders (ISPs) and server machines can come and go over the years. Moreover, some ISPs
292 | Chapter 6: Complete System Programs