This assumption is based on the fact that
VBScript, when used in web pages, is not permitted to access the filesystem
for obvious security reasons.
The following routines, all of which rely on the FileSystemObject object,
should provide most necessary file operations. The names I??™ve chosen for
these functions and subroutines are based on what they act upon and what
they??™re used for; for example, the FolderCopy subroutine is used to copy a
folder, and the FileCopy subroutine is used to copy a file.
The following two functions return properties of drives??”whether a specific
drive letter exists and how much free space a specified drive has, respectively:
Function DriveExists(DriveLetter)
Set FileObject = CreateObject("Scripting.FileSystemObject")
DriveExists = FileObject.DriveExists(DriveLetter)
End Function
Function DriveFreeSpace(DriveLetter)
If Left(DriveLetter,1) <> ":" Then DriveLetter = DriveLetter & ":"
Set FileObject = CreateObject("Scripting.FileSystemObject")
Set DriveHandle = _
FileObject.GetDrive(FileObject.GetDriveName(DriveLetter))
DriveFreeSpace = DriveHandle.FreeSpace
End Function
These next seven subroutines and functions are used to manipulate folders.
The functions are used to retrieve information about a folder, and the subroutines
are used to perform actions on a folder. The arguments should all
be full folder names (e.g., C:\Users\Lurlene\Desktop). Note that the
FolderSize function returns the combined size of all the contents of a folder,
including all subfolders, and may take a few seconds to return a result for
large folders.
Pages:
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733