kcw | journal | 2000 << Previous Page | Next Page >>

Remember to comment your code. I know that a lot of programmers don't do it well, and I sometimes don't do it. But it's really frustrating to look at code you wrote six months ago and not be able to figure out why you put this certain statement in. The difference between a software developer and a programmer is in the amount of inline code commenting. The difference between a software engineer and a software developer is the amount of external documentation.

	-- backup command from Satimage Additions

set l_filelist to Â
backup v_destination onto Â
v_source level 0 Â
with recursively

This is basic call to the Satimage Additions backup command. 'level 0' means don't backup, just list the files; 'with recursively' is done so that the subfolders are also examined. The results go into a variable called l_filelist.

When I run backup with this command:

backup "ATA_02:Kevin:Temp" Â
onto "ATA_02:Kevin:Temp copy" Â
level 0 with recursively

I get:

"ElŽments ˆ mettre ˆ jour : 
ATA_02:Kevin:Temp copy:BTP:BTP-03.jpg
ATA_02:Kevin:Temp copy:hl1.jpg
ElŽments ˆ crŽer :
ATA_02:Kevin:Temp copy:BTP:BTP-02.jpg
ATA_02:Kevin:Temp copy:BTP:BTP-04.jpg
ATA_02:Kevin:Temp copy:BTP:BTP-05.jpg
ATA_02:Kevin:Temp copy:cf.jpg
ATA_02:Kevin:Temp copy:chill1.mov
ATA_02:Kevin:Temp copy:chill2.mov
ATA_02:Kevin:Temp copy:cuba_gooding_jr_6.jpg
"

Notice the French labels, since Satimage Additions was made by a French company. Also note that the lines are separated by "\r\t" (return and tab). The files to change section always comes first, something to keep in mind when we look for the correct filenames. Note that the last element ends with a \r, something that will have to be stripped out later. Finally, the file names list the files that will be created in the destination directory. For our purposes we need to delete files from the source directory, so we have to replace the beginning part of the file specification to point to the source file, hence why we asked for v_source_base_length and v_destination_base.

What's the limit that a variable can hold? This will matter if you want to run backup from one hard disk to another, you could get thousands of files. My guess is that it is 32 kb, but it's not really that important for me since I have less files to backup. If I were trying to make this into a general use utility that anyone could use, then I would have to worry about such things and add better error catching.

More in the next entry..
Copyright (c) 2000 Kevin C. Wong
Page Created: August 17, 2004
Page Last Updated: August 17, 2004