The Date object also provides time support, so you don??™t need a separate Time variable.
At this point, it??™s time to begin collecting a list of temporary files on the system. This example,
like its batch file counter, relies on an external file to hold the file specifications. The code opens the
file and begins processing it one line at a time. The use of a constant value of 1 for the
FSO.OpenTextFile() method opens the file in read-only mode. The code processes the file one line
at a time (one file specification at a time) using the DirSpec.ReadLine() method. You can read one
character at a time using the DirSpec.Read() method instead.
This example points out a very special feature of the scripting languages. Notice the use of the
Shell.Run() method. You can use this method to run any application. To use this feature at the
command prompt, you have to begin by creating a command processor using the CMD utility as
shown. In this case, the code runs the Dir command with the file specification obtained from
DelFiles.TXT. This line of code begs the question of why the code doesn??™t use the
FileSystemObject. In this particular case, you can perform the task faster and without any loss of
functionally by using the Dir command.
Pages:
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484