6.3 Entry Object

Represents a file or directory.

The following methods return an Entry object:

6.3.1 Attributes property

Sets or returns the attributes of a file or directory.

Syntax

 object.Attributes[=Attr As Integer]
 

Type

Integer.

Attributes

Read/write.

Remarks

Attr is an optional parameter that sets the attributes for the Entry object. See Attribute Constants.

Example

This example returns the attributes of the file User.

 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("Attributes of " & Entry1.Name & " are : " &Entry1.Attributes) 
 wend
 

6.3.2 Directory property

Determines whether or not the Entry object is a directory.

Syntax

 object.Directory
 

Type

Boolean.

Attributes

Read-only.

Remarks

This property returns TRUE if the Entry object is a directory.

Example

This example returns TRUE if the object User is a directory.

 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 
 if(Entry1.Directory = TRUE) then 
      print("Entry1.Name & " is a directory")
 else 
      print("Entry1.Name & " is a file")
 endif 
 wend
 

6.3.3 ModifyDate property

Sets or returns the date the entry was modified.

Syntax

 object.ModifyDate[=DateValue As Date]
 

Type

Date.

Attributes

Read/write.

Remarks

Date is an optional parameter that sets the modification date for the file.

Example

This example returns the date the file USER was modified.

 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("Modification date of " & Entry1.Name & " is: " 
 Entry1.ModifyDate) 
 wend
 

6.3.4 Name property

Sets or returns the name of a file or directory.

Syntax

 object.Name
 

Type

String.

Attributes

Read/write.

Remarks

Change the value of this property to rename the actual file or directory.

Example

This example returns the name of the next file 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.3.5 Size property

Returns the size of the file.

Syntax

 object.Size
 

Type

String.

Attributes

Read-only.

Remarks

If the object is a directory, this property returns 0 (zero).

Example

This example returns the size of the file USER. If USER is a directory, this property returns 0.

 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("Size of " & Entry1.Name & " is : " &Entry1.Size) 
 wend
 

6.3.6 GetChildren method

Returns child entries of a directory.

Syntax

 object.GetChildren(
    [NameFilter As String], 
    [TypeFilter As Integer])
 

Parameters

NameFilter
Optional. The name filter to mask unwanted entries (default=*).
TypeFilter
Optional. Masks unwanted entries. This parameter can have any of the Directory Entry Filter Constants. The default is DIR_OPT_ALL.

Return Values

Entries. If the current object is a directory, this method returns its child entries; otherwise, NULL.

Example

If the current object is a directory, this GetChildren example returns its child Entries. If it is not a directory, this example returns NULL

 set dosfm = CreateObject("ucx:DosFileMgr") 
 set Entry = dosfm.FindEntry("c:\USER") 
 set Entries = Entry.GetChildren("*.*",DIR_OPT_FILES) 
 set Entry1 = Entries.Element("Test") 
 if(Entry1.Directory = TRUE) then 
 while(Entries.HasMoreElements = TRUE) 
      print("Entry1.Name & " is a directory") 
 else 
      print("Entry1.Name & " is a file") 
 endif