Dart Ftp Control
NameList Method
Optional. Specifies a path on the host. Wildcards are permitted. If this parameter is omitted then it defaults to all the files in the current directory.
Description
Get a file directory listing without file attributes. The server sends a file name for each file found within the PathName specified. The Listing property is filled with filenames (only the Name property is initialized).
Syntax
Visual Basic
Public Sub NameList( _
   Optional ByVal PathName As String _
) 
Parameters
PathName
Optional. Specifies a path on the host. Wildcards are permitted. If this parameter is omitted then it defaults to all the files in the current directory.
Remarks

The Type property should be ftpAscii or ftpEbcdic. If ftpImage is specified, then lines may not terminate with a CR/LF, creating a formatting problem.

This method sequences and sends the ftpType, ftpPort or ftpPassive, and ftpNameList commands.

The Progress event fires as each reply is received. If Timeout is greater than 0, this method blocks until the listing is received from the server or a ptTimeout error occurs. If Timeout is 0, this method immediately returns.

Error Codes

This method may generate the following error code (refer to ErrorConstants for a complete list of error codes):

Example
This example shows how to get a file directory listing without file attributes.
Private Sub Command1_Click()
	On Error Goto OnError ' use intrinsic error handling
	Ftp1.Login "ftp.dart.com", "anonymous", "powertcp"
	If Ftp1.State = tcpConnected Then MsgBox "Connected!"
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub
 
Private Sub Command2_Click()
	On Error Goto OnError ' use intrinsic error handling
	Ftp1.Timeout = 1000
	Ftp1.NameList
	Text1.Text = Ftp1.Listing.Text ' show list of filenames to user
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub
See Also

Ftp Object  | Ftp Members


PowerTCP FTP for ActiveX Documentation Version 2.2
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic