13.3 Entry Object

Enumerates the files and directories on a remote FTP host.

13.3.1 Attributes property

Returns the attributes of a file or directory.

Syntax

 object.Attributes
 

Type

String.

Attributes

Read-only.

Example

This example returns the attributes of the file log.txt.

 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set entry = ftpmgr.findentry ("/home/user/log.txt") 
 print ("File name : " &entry.name &"File attributes: " &entry.attributes) 
 ftpmgr.logout()
 

13.3.2 Directory property

Determines whether or not the Entry object is a directory.

Syntax

 object.Directory
 

Type

Boolean.

Attributes

Read-only.

Remarks

If the object is a directory, this property returns a message indicating so; otherwise, it returns a message indicating that the object is a file.

Example

This example returns the message "log is a directory" if the object log is a directory; otherwise, it returns the message "log is a file".

 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set entry = ftpmgr.findentry ("/home/user/log") 
 if (entry.directory) then 
      print (entry.name &" is a directory") 
 else 
      print (entry.name &" is a file") 
 end if 
 ftpmgr.logout()
 

13.3.3 ModifyDate property

Returns the date the Entry object (file or directory) was last modified.

Syntax

 object.ModifyDate
 

Type

Date.

Attributes

Read-only.

Example

This example returns the date the file log.txt was last modified.

 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set entry = ftpmgr.findentry ("/home/user/log") 
 print ("File name: " &entry.name &"File Modification Date: " &entry.ModifyDate) 
 ftpmgr.logout()
 

13.3.4 Name property

Sets or returns the name of a file or directory.

Syntax

 object.Name[=NewName As String]
 

Type

String.

Attributes

Read/write.

Remarks

NewName is an optional parameter that sets the name of the file or directory.

Example

This example returns the name of the file log.txt.

 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set entry = ftpmgr.findentry ("/home/user/log.txt") 
 print ("File name : " &entry.name &"File Attributes: " &entry.attributes) 
 ftpmgr.logout()
 

13.3.5 Owner property

Returns the owner of a file or directory.

Syntax

 object.Owner
 

Type

String.

Attributes

Read-only.

Example

This example returns the owner of the file log.txt.

 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set entry = ftpmgr.findentry ("/home/user/log.txt") 
 print ("File name : " &entry.name &"File owner: " &entry.owner) 
 ftpmgr.logout()
 

13.3.6 Size property

Returns the size of a 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 log.txt.

 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set entry = ftpmgr.findentry ("/home/user/log.txt") 
 print ("File name: " &entry.name &"File size: " &entry.size) 
 ftpmgr.logout()
 

13.3.7 GetChildren method

Returns child entries of a directory.

Syntax

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

Parameters

NameFilter
Optional. The FileSpec 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. If it is a file, it returns NULL.

Example

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

 ’NSN example to print the details of files and directories on the remote host 
 set ftpmgr = createobject ("ucx:ftpfilemgr") 
 ftpmgr.server = "193.97.54.165" 
 ftpmgr.login ("User", "password") 
 set currentDir = ftpmgr.currentDir 
 set entries = currentDir.getchildren() 
 entries.reset 
 while (entries.hasmoreelements) 
      set Entry=entries.next 
      print (entry.name &" " &entry.modifydate) 
 wend 
 ftpmgr.logout()