Link:http://output.to/sideway/default.asp?qno=130300023 File System Manipulation, ASP Server Component, Built-in Function, FileSystemObject Object FileSystemObject ObjectOne function of FileSystemObject object is the manipulation of general file system information. One type of the file system manipulation is related to the local system. The other type of the file system manipulation is related to the path string editing and the path string need not be an existing path. FileSystemObject.GetExtensionNameFileSystemObject.GetExtensionName method is the method to return the string of the file extension of the last component from the specified path related to the specified FileSystemObject Object. Syntax:FileSystemObjectName.GetExtensionName(path) Or in VBScript. Imply pathext = FileSystemObjectName.GetExtensionName(path) Or in JScript. Imply pathext = FileSystemObjectName.GetExtensionName(path) Parameters:pathext The parameter "pathext" is the name assigned to the path extension string returned by the method using the FileSystemObjectName.GetExtensionName Method. FileSystemObjectName The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to. path The parameter "path" is used to specify an existing path to which the path extension to be returned. The "path" is not necessary to specify any existing folder. Return Values:path extension string The method returns a string of the path extension related to the specified FileSystemObject Object. Remarks:FileSystemObjectName should always refer to a FileSystemObject Object. For network drives, the root directory (\) is considered to be a component. The GetExtensionName Method returns an empty string ("") if the file of the last component of the specified path does not exist. Examples:
FileSystemObject.GetTempName MethodFileSystemObject.GetTempName method is the method to return a randomly generated temporary name for used as a temporary file or folder name related to the specified FileSystemObject Object. Syntax:FileSystemObjectName.GetTempName() Or in VBScript. Imply tname = FileSystemObjectName.GetTempName() Or in JScript. Imply tname = FileSystemObjectName.GetTempName() Parameters:tname The parameter "tname" is the name assigned to the temporary name string randomly generated and returned by the method using the FileSystemObjectName.GetTempName Method. FileSystemObjectName The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to. Return Values:tname string The method returns a string of the randomly generated temporary name related to the specified FileSystemObject Object. Remarks:FileSystemObjectName should always refer to a FileSystemObject Object. The GetTempName method only returns a randomly generated temporary name for further use. The GetTempName method itself does not create a file or a folder but the randomly generated temporary name can be used as a randomly generated temporary file name or folder name. Examples:
Link:http://output.to/sideway/default.asp?qno=130300024 DriveExists / GetDriveName / GetDrive, FileSystemObject Object, ASP Server Component FileSystemObject ObjectOne function of FileSystemObject object is the manipulation of drives of the file system. FileSystemObject.DriveExistsFileSystemObject.DriveExists method is the method to check whether the specified drive specification exist or not. The DriveExists method returns True if the specified drive exists and the DriveExists method returns False if the specified drive does not exist. Syntax:FileSystemObjectName.DriveExists(drivespec) Or in VBScript. Imply driveflag = FileSystemObjectName.DriveExists(drivespec) Or in JScript. Imply driveflag = FileSystemObjectName.DriveExists(drivespec) Parameters:driveflag The parameter "driveflag" is the name assigned to the Boolean value returned by the method using the FileSystemObjectName.DriveExists Method. FileSystemObjectName The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to. drivespec The parameter "drivespec" is used to specify the drive to be checked. The value of parameter "folderspec" can be a drive letter or a completer drive specification. Return Values:Boolean value The method returns a Boolean value to indicate whether the specified drive exist or not related to the specified FileSystemObject Object. Remarks:FileSystemObjectName should always refer to a FileSystemObject Object. For drive with removable media, the DriveExists method returns true even if there is no media present. And a removable media can use IsReady property of the Drive object to determine whether the drive is ready. Examples:
FileSystemObject.GetDriveName MethodFileSystemObject.GetDriveName method is the method to get the name of the drive string from the specified path specification related to the specified FileSystemObject Object. Syntax:FileSystemObjectName.GetDriveName(path) Or in VBScript. Imply drvname = FileSystemObjectName.GetDriveName(path) Or in JScript. Imply drvname = FileSystemObjectName.GetDriveName(path) Parameters:drvname The parameter "drvname" is the name assigned to the drive name string returned by the method using the FileSystemObjectName.GetDriveName Method. FileSystemObjectName The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to. Path The parameter "Path" is used to specify the path specification for the component of which the drive name to be returned. Return Values:drvname string The method returns a string of the drive name related to the specified FileSystemObject Object. The GetDriveName method returns a zero-length string ("") if the drive can't be determined. The GetDriveName method only returns the drive name on the provided path string neither the conflict on the specified path nor the existence of the specified path will be checked. Remarks:FileSystemObjectName Method should always refer to a FileSystemObject Object. Examples:
FileSystemObject.GetDrive MethodFileSystemObject.GetDrive method is the method to return an instance of a Drive object corresponding to the specified drive specification related to the specified FileSystemObject Object. Syntax:FileSystemObjectName.GetDrive(drivespec) Or in VBScript. Imply DriveObjectName = FileSystemObjectName.GetDrive(drivespec) Or in JScript. Imply DriveObjectName = FileSystemObjectName.GetDrive(drivespec) Parameters:DriveObjectName The parameter "DriveObjectName" is the name assigned to the Drive object returned by the method using the FileSystemObjectName.GetDrive Method. FileSystemObjectName The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to. drivespec The parameter "drivespec" is used to specify the drive specification for the Drive object to be returned. The parameter drivespec can be a drive letter (c), a drive letter with a colon appended (c:), a drive letter with a colon and path separator appended (c:\), or any network share specification (\\computera\share\). Unlike the return of drive name, an error occurs if the parameter drivespec does not conform to one of the accepted forms or does not exist. For network shares, a check is made to ensure that the share exists. Return Values:Drive object The method returns an instance of Drive object corresponding to the specified drivespec related to the specified FileSystemObject Object. Remarks:FileSystemObjectName should always refer to a FileSystemObject Object. A normal path string for the drivespec of GetDrive method can be obtained by using a sequence of Methods on an existing path: drivespec = fso.GetDriveName(fso.GetAbsolutePathName(path)) Examples:
|
Sideway BICK Blog 19/03 |