6.4 Entries Collection

Represents the collection of files and subdirectories in a particular directory.

The following methods return an Entry object:

6.4.1 AddElement method

Creates a directory on the server.

Syntax

 object.AddElement(
    dirName As String)
 

Parameters

dirName
The name of the directory to create.

Return Values

Entry.

Example

This example creates the directory SAMPLES.

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\user") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 Entries.AddElement("SAMPLES")
 

6.4.2 Element method

Finds a file or directory by name.

Syntax

 object.Element(
    entryName As String)
 

Parameters

entryName
The name of the file or directory to find.

Return Values

Entry. Returns the specified Entry object if present; otherwise, NULL.

Remarks

The parameter, entryName, can be either the name of a file or the name of a directory.

Example

This example finds the file test.c.

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\user") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 set Entry1 = Entries.Element("test.c")
 

6.4.3 HasMoreElements method

Determines whether or not any more Entry objects exist in the collection based on the specified path.

Syntax

 object.HasMoreElements(
    Path As String)
 

Parameters

Path
The absolute path of the file or directory to search.

Return Values

Boolean. Returns TRUE if the collection contains more Entry objects. otherwise, FALSE.

Example

This example determines whether more Entry objects exist in the collection.

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\user") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 Entries.Reset 
 while(Entries.HasMoreElements = TRUE) 
 set Entry1 = Entries.Next () 
 print("Name of the file is:" & Entry1.Name) 
 wend
 

6.4.4 Next method

Returns the next Entry object in the Entries collection.

Syntax

 object.Next()
 

Parameters

None.

Return Values

Entry. Returns the next Entry object in the Entries collection.

Example

This example returns the next Entry object in the collection.

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\user") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 Entries.Reset() 
 while(Entries.HasMoreElements = TRUE) 
 set Entry1 = Entries.Next() 
 print("Name of the file is:" & Entry1.Name) 
 wend
 

6.4.5 RemoveElement method

Deletes the specified Entry object.

Syntax

 object.RemoveElement(
    entryName As String)
 

Parameters

entryName
The name of the file or directory to delete.

Return Values

Boolean. Returns TRUE if the Entry object is successfully removed. otherwise, FALSE.

Remarks

The entryName parameter can be either the name of a file or the name of a directory.

Example

This example removes the file samples.c from the collection.

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\user") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 Entries.RemoveElement("samples.c")
 

6.4.6 Reset method

Resets the collection of entries.

Syntax

 object.Reset()
 

Parameters

None.

Return Values

Void.

Example

This example resets the collection of entries.

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\user") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 Entries.Reset 
 while(Entries.HasMoreElements = TRUE) 
 set Entry1 = Entries.Next 
 print("Name of the file is:" & Entry1.Name) 
 wend