This way, you??™re only bothered with the errors that
concern you.
This example also uses the Do...Loop loop structure (which is similar to the
For...Next loop, documented earlier in this chapter) at the beginning of the
script. The code inside such a loop is repeated until a specific condition is
met; in this case, the loop will repeat until the Accepted variable has a value
of True (notice that it??™s set to False at the beginning of the script). The If...
Then structures ensure that the Accepted variable is only set to True if the
folder actually exists.
The second part of the script compares the total size of the folder and all its
contents with the amount of free space on the target drive. You could
expand the script, so that if the diskette is not sufficient to store the folder,
the user is given the opportunity to insert another diskette and try again.
You??™d need to use a similar Do...Loop, as described earlier.
Once the script has gone through all of the tests (eliminating the possibility
of most errors), the FolderCopy subroutine copies the folder to the floppy.
Finally, the WriteToFile subroutine records in a logfile that the folder was
backed up. Note also the preceding line that adds a backslash (\) to the end
of the MyFolder variable; this way, you can pass a valid filename (the folder
name followed by a backslash and then the filename) to the WriteToFile
subroutine.
This script requires the following subroutines, which are found earlier in this
book: DriveFreeSpace, FolderCopy, FolderCreate, FolderExists, FolderSize,
and WriteToFile.
Pages:
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764