11.5 Folder

Provides access to all the properties of a folder.

11.5.1 Attributes property

Sets or returns the attributes of the folders.

Syntax

 object.Attributes=[newAttributes As Integer)
 

Type

Integer. (See Attribute Constants)

Attributes

Read-write.

Remarks

newAttributes is a new value for the attributes of a specified object.Attributes can be set for only NetWare files .

Example

See sample in Example

11.5.2 DateCreated property

Returns the date and time when the specified folder was created.

Syntax

 object.DateCreated
 

Type

Date.

Attributes

Read-only.

Example

See sample in Example

11.5.3 DateLastAccessed property

Returns the date and time when the specified folder was last accessed.

Syntax

 object.DateLastAccessed
 

Type

Date.

Attributes

Read-only.

Example

See sample in Example

11.5.4 DateLastModified property

Returns the date and time when the specified folder was last modified.

Syntax

 object.DateLastModified
 

Type

Date.

Attributes

Read-only.

Example

See sample in Example

11.5.5 Files property

Returns a Files collection object containing the File objects (Section 11.4, File) present in the specified folder, including those with hidden and system file attributes set.

Syntax

 object.Files
 

Attributes

Read-write.

Example

See sample in Example

11.5.6 Filter

Filters specified entry in the collection object. The Default value will be *.*.

Syntax

 Object.Filter = [Newfilter As String]
 

Type

String

Attributes

Read-Write.

Remarks

NewFilter is the new value added for the filter of the specified object.

Example

See sample in Example

11.5.7 IsRootFolder property

Returns TRUE if the specified folder is the root folder.

Syntax

 object.IsRootFolder
 

Type

Boolean.

Attributes

Read-only.

Example

See sample in Example

11.5.8 Name property

Sets or returns the name of a specified folder.

Syntax

 object.Name[=newname As String]
 

Type

String.

Attributes

Read-write.

Example

See sample in Example

11.5.9 ParentFolder property

Returns the folder object for the parent of the specified folder.

Syntax

 object.ParentFolder
 

Type

Folder.

Attributes

Read-only.

Example

See sample in Example

11.5.10 Path property

Returns the path for a specified folder.

Syntax

 object.Path
 

Type

String.

Attributes

Read-only.

Example

See sample in Example

11.5.11 ShortName property

Returns the short name of a folder in 8.3 naming convention.

Syntax

 object.ShortName
 

Type

String.

Attributes

Read-only.

Example

See sample in Example

11.5.12 ShortPath property

Returns the short path in 8.3 naming convention.

Syntax

 object.ShortPath
 

Type

String.

Attributes

Read-only.

Example

See sample in Example

11.5.13 Size property

Returns the size in bytes, of the specified folder.

Syntax

 object.Size
 

Type

Long.

Attributes

Read-only.

Example

See sample in Example

11.5.14 SubFolders property

Returns a Folders collection with the subfolders contained in a specified folder, including those with Hidden and System file attributes set.

Syntax

 object.SubFolders
 

Type

FoldersCollection.

Attributes

Read-only.

Example

See sample in Example

11.5.15 Copy method

Copies a specified folder from one location to another.

Syntax

 object.Copy( 
    Destination As String
    [, Overwrite As Boolean])
 

Parameters

Destination
Destination where the file or folder is to be copied.
Overwrite
Boolean. If set to TRUE, the existing folders are overwritten.

Return Values

Boolean. Returns TRUE if the folders are successfully copied to the specified location.

Remarks

The existing folders can be overwritten only in NetWare files.

If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.

Example

This example copies \TEMP to Sys:\nsn.

 <% Set FSO = CreateObject("Scripting.FileSystemObject")
 
 ’Returns the folder object
 set Folder = FSO.GetFolder("sys:\nsn\user\temp") %>
    
 <% ’Returns the attributes of the set file object
 Response.Write Folder.Attributes %><br>
 
 <% ’Returns the folder creation date
 Response.write Folder.DateCreated %><br>
 
 <% ’Returns the last accessed date
 
 Response.Write Folder.DateLastAccessed %> <br>
 
 <% ’Returns last modified date
 Response.Write Folder.DateLastModified %><br>
 
 <% ’Returns TRUE if the folder is the root folder
 Response.Write Folder.IsRootFolder %><br>
 
 <% ’Returns the parent folder name
 Response.Write Folder.ParentFolder %><br>
 
 <% ’Returns the folder path
 Response.Write Folder.Path %><br>
 
 <% ’Returns the short name of the folder
 Response.Write Folder.ShortName %><br>
 
 <% ’Returns the short path
 Response.Write Folder.ShortPath %><br>
 
 <% ’Returns the size of the folder in bytes
 Response.Write Folder.Size %><br>
 
 <% ’Returns the files object present in the set folder
 Set Files = Folder.Files %>
 
 <% ’Sets filter for printing all the file names
 Folder.Filter = "*.*" 
 For Each File in Folder.Files
 Response.Write File.Name
 Next  %><br>
 
 <% ’Sets filter for printing file names with .bat extension’
 Folder.Filter = "*.bas" 
 For Each File in Folder.Files
 Response.Write File.Name
 Next %><br>
 
 <% ’Returns the folders object containing collection of sub
 folders
 set Folders = Folder.SubFolders %>
 
 <% ’Returns the number of folders in the collection object
 Response.Write Folders.Count  %><br>
 
 <% ’Copies the folder to UTIL directory
 Response.Write Folder.Copy ("Sys:\nsn\util\") %><br>
 
 <% ’Renames the folder as TEST
 Response.Write Folder.Name  = "TEST" %>
 

11.5.16 CreateTextFile method

Creates a specified file name and returns a TextStream object (Section 11.3, TextStream) that can be used to read from or write to a file.

Syntax

 object.CreateTextFile(
    FileName As String [,
    OverWrite As Boolean [,
    Unicode As Integer]])
 

Parameters

FileName
String expressions that identifies the file to create.
Overwrite
Boolean. If set to TRUE, the file is overwritten. If omitted, existing files are not overwritten.
Unicode
Boolean. If set to TRUE, the file is created as a Unicode file, otherwise as an ASCII file. If omitted, an ASCII file is assumed.

Return Values

Section 11.3, TextStream.

Remarks

If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.

Example

This example creates TEST.TXT (or overwrites if it exists) in Unicode format.

 <% Set FSO = CreateObject("Scripting.FileSystemObject")
  set Folder = Folders.CreateTextFile("sys:nsn\user\test.txt", TRUE, TRUE)%>
 

11.5.17 Delete method

Deletes a specified folder.

Syntax

 object.Delete([ 
    Force As Boolean])
 

Parameters

Force
Boolean. Set to TRUE if the folder with read-only attribute are to be deleted.

Return Values

Boolean.Returns TRUE if the folders are successfully deleted from the specified location.

Remarks

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.

Example

This example returns TRUE, and will delete SYS:\NSN\SAMPLE even if it has read-only attributes.

 	<% Set FSO = CreateObject("Scripting.FileSystemObject") %>
 		<% ’Deletes a folder sample in NSN under Sys:
 		Response.Write FSO.DeleteFolder("sys:\nsn\sample") %>
 

11.5.18 Move method

Moves a specified folder from one location to another.

Syntax

 object.Move( 
    Destination As String)
 

Parameters

Destination
Location where the folder is to be moved.

Return Values

Boolean. Returns TRUE if the folders are successfully moved.

Example

This example moves the fodler TEMP from \UTIL to SYS:\NSN\UTIL.

 <% Set FSO = CreateObject("Scripting.FileSystemObject")
 ’Moves the folder TEMP from USER to UTIL directory
 Response.Write
 FSO.MoveFolder("sys:\nsn\user\temp","sys:\nsn\util\") %>