Provides access to all the properties of a file.
Sets or returns the attributes of a file.
Integer. (See Attribute
Constants
)
object.Attributes=[newAttributes As Integer]
Read-write.
newAttributes is a new value for the attributes of a specified object.Attributes can be set for NetWare files.
See sample in Example.
Returns the date and time when the specified file was created.
object.DateCreated
Date.
Read-only.
See sample in Example.
Returns the date and time when the specified file was last accessed.
object.DateLastAccessed
Date.
Read-only.
See sample in Example.
Returns the date and time when the specified file was last modified.
object.DateLastModified
Date.
Read-only.
See sample inExample.
Sets or returns the name of a specified file.
object.Name[=newname]
String.
Read-write.
newname is the new name of the specified object.
See sample in Example.
Returns the folder object for the parent of the specified file.
object.ParentFolder
Read-only.
See sample in Example.
Returns the path for a specified file.
object.Path
String.
Read-only.
See sample in Example.
Returns the short name of a file used by the programs in 8.3 naming convention.
object.ShortName
String.
Read-only.
See sample in Example.
Returns the short path in 8.3 naming convention.
object.ShortPath
String.
Read-only.
See sample in Example.
Returns the size of the specified file in bytes.
object.Size
Long.
Read-only.
See sample in Example.
Copies a specified file from one location to another.
object.Copy(
Destination As String
[, Overwrite As Boolean])
Boolean. Returns TRUE if the files are successfully copied to the specified location.
The existing folders can be over-written only in NetWare files.
If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.
See sample in Example.
Deletes a specified file.
object.Delete([
Force As Boolean])
Boolean. Returns TRUE if the file is successfully deleted.
The existing folders with read-only attributes can be deleted only in NetWare files.
If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.
This example deletes FILETEST.TXT, even if read-only attributes are set. The file should exist in the specified directory.
<% Set FSO = CreateObject("Scripting.FileSystemObject")
’Returns the file object
Set File = FSO.GetFile("Sys:\nsn\util\FileTest.txt")
Response.Write File.Delete (TRUE) %>
Moves a specified file from one location to another.
object.Move(
Destination As String)
Boolean. Returns TRUE if the files are successfully moved.
If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.
This example moves the file FILETEST.TXT from Sys:\nsn\user to Sys:\nsn\util\FILETEST.BAS.
<% Set FSO = CreateObject("Scripting.FileSystemObject")
’Returns the file object
Set File = FSO.GetFile("Sys:\nsn\user\FileTest.txt")
Response.Write File.Move ("sys:\nsn\util\filetest.bas") %>
Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
object.OpenAsTextStream([
IOMode As Integer [,
Format As Integer]])
File Open Constants).
This example opens TEST1.TXT and returns the all the properties related to that file. It also opens the file as a text file for editing.
<% Set FSO = CreateObject("Scripting.FileSystemObject")
’Returns the file object
Set File = FSO.GetFile("Sys:\nsn\user\sample.txt")
’Renames the file to FILETEST.TXT
File.Name = "FileTest.txt" %>
<% ’Returns the attributes of the set file object
Response.write File.Attributes%><br>
<% ’Returns the file creation date
Response.write File.DateCreated %><br>
<% ’Returns the last accessed date
Response.Write File.DateLastAccessed %> <br>
<% ’Returns last modified date
Response.Write File.DateLastModified %><br>
<% ’Returns the name of the parent folder
Response.Write File.ParentFolder %><br>
<%’Returns the shortname of the file
Response.Write File.ShortName %><br>
<% ’Copies the file to UTIL directory
Response.Write File.Copy ("Sys:\nsn\util") %><br>
<%’Returns the shortpath of the file
Response.Write File.ShortPath %><br>
<%’Returns the file size
Response.Write File.Size %><br>
<% ’Sets the file as a text file in edit mode
Set text = File.OpenAsTextStream(8)
text.write ("Sample script")
text.readall() %>