Practical 6 & Project 3

Task 6.1 [1 mark]: Write a script to list all .jpg files in your computer by using FileSystemObject. The result should be put in a text file.

Optional: How does Powershell perform the same task? Why not try it out?!


Task 6.2 [1 mark]: Write a VBscript program to search one of your local drives for file “test.txt”. If it does not exist, create one using FileSystemObject; otherwise, using GetFile method of FileSystemObject to toggle the attribute of this file, that is, if it is not “read-only”, set it to be “read-only”; if it is “ready-only”, set it to be any type that is not “read-only”.

Optional: Powershell should finish the job as well. Do you wonder how?


Task 6.3 [0.5 mark]: Download the program FileOperationCollection.vbs, run it and explain the meaning of each statement of the program (delete all comments).


Project 3:

Write a VBScript program that can automatically backup .doc and .txt files (using Powershell for this project is aslo acceptable). This program should contain the following subroutines or functions:

ST1 [1.5 marks]: CheckDrive -- This function searches for a local drive that has more than 10mb free space. Return the drive name if found.

ST2 [1.5 marks]: CheckBackupFolder -- This subroutine makes a folder “autoBackup” on the drive you found with enough space. If the folder already exists, do nothing.

ST3 [1.5 marks]: SearchFiles -- This subroutine searches all the drives you can reach for all .doc and .txt files (excluding all the files in “autoBackup”). Output the result to a text file “updateFiles.txt” (each record contains the file name and the last modified date).

ST4 [2.0 marks]: compareFiles -- This subroutine checks each file in updateFiles.txt to see whether the file needs to backup. If a file has been in autoBackup folder and its last modified date has not been changed, delete the file from updateFiles.txt.

ST5 [1.0 marks]: backupFiles -- This subroutine copies all the files whose names are in updateFiles.txt to the autoBackup folder.   


Write a mainstream to call these functions and subroutines in sequence.


Marking criteria:


This Practical and Project will be marked (10% of total marks)


Practical 6 Task 6.1-6.3 will be due in week 7 (in tutorial session, no delay is allowed).


Project 3 tasks will be due in week 8. That is, your work must be ready for checking at the beginning of your tutorial class in Week 8 - no delay is allowed. The project MUST be submitted electronically via the unit website by the due time [penalty for late submission applies otherwise]. For submitting your project 3, check 'Assignments', then choose 'Project 03' where you can attach files and perform submission.



A true and proper attempt must be in evidence. Students' performance regarding the task implementation will be individually checked. Students are encouraged to present programs which are fully tested. Any program language errors, run time errors, and logical errors will detract from the full marks. Common coding features like robustness, extensibility, and flexibility are also taken into account for grading. No marks for the project can be obtained without demonstrating your work during laboratory and submitting your work onto vUWS. Marks will be deducted for late submission.