- files differ at C:\temp\PP3E\Examples\PP3E\System\Filetools\commands.py –
copytemp\PP3E\System\Filetools\commands.py
I added line breaks and tabs in a few of these output lines to make them fit on this page,
but the report is simple to understand. In a tree with 1,430 files and 185 directories,
we found five differences—the three files we changed by edits, and the two directories
we threw out of sync with the three removal commands.
Verifying Backups
So how does this script placate CD backup paranoia? To double-check my CD writer’s
work, I run a command such as the following. I can also use a command like this to
find out what has been changed since the last backup. Again, since the CD is “G:” on
my machine when plugged in, I provide a path rooted there; use a root such as /dev/
cdrom or /mnt/cdrom on Linux:
C:\...\PP4E\System\Filetools> python diffall.py Examples g:\PP3E\Examples > diff0226
C:\...\PP4E\System\Filetools> more diff0226
...output omitted...
The CD spins, the script compares, and a summary of differences appears at the end
of the report. For an example of a full difference report, see the file diff*.txt files in the
book’s examples distribution package. And to be really sure, I run the following global
comparison command to verify the entire book development tree backed up to a mem-
ory stick (which works just like a CD in terms of the filesystem):
C:\...\PP4E\System\Filetools> diffall.py F:\writing-backups\feb-26-10\dev
C:\Users\mark\Stuff\Books\4E\PP4E\dev > diff3.txt
C:\...\PP4E\System\Filetools> more diff3.txt
--------------------
Comparing F:\writing-backups\feb-26-10\dev to C:\Users\mark\Stuff\Books\4E\PP4E\dev
Directory lists are identical
Comparing contents
ch00.doc DIFFERS
ch01.doc matches
ch02.doc DIFFERS
ch03.doc matches
ch04.doc DIFFERS
ch05.doc matches
ch06.doc DIFFERS
...more output omitted...
--------------------
Comparing F:\writing-backups\feb-26-10\dev\Examples\PP4E\System\Filetools to C:\...
Files unique to C:\Users\mark\Stuff\Books\4E\PP4E\dev\Examples\PP4E\System\Filetools
... copytemp
... cpall.py
... diff2.txt
... diff3.txt
... diffall.py
... diffs.txt
... dirdiff.py
... dirdiff.pyc
316 | Chapter 6: Complete System Programs