Dart Ftp Control
List Method
Optional. Specifies a path on the host. Wildcards are permitted, as well as modifiers for the list command. If this parameter is omitted then it defaults to all the files in the current directory.
Description
Get a file directory listing. The server sends name and supplementary information on each file found within the specified PathName. The Listing property is populated with this information.
Syntax
Visual Basic
Public Sub List( _
   Optional ByVal PathName As String _
) 
Parameters
PathName
Optional. Specifies a path on the host. Wildcards are permitted, as well as modifiers for the list command. If this parameter is omitted then it defaults to all the files in the current directory.
Remarks

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

This method sequences and sends the ftpTypeftpPort or ftpPassive, and ftpList commands.

If Timeout is greater than 0, List blocks until the listing is received or a ptTimeout error occurs. If Timeout is 0, List immediately returns and the Progress event fires multiple times as each reply is received.

Error Codes

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

Example
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.List "-lr" ' a full recursive listing is requested
	Text1.Text = Ftp1.Listing.Text ' show to user
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub

Private Sub Command3_Click(
	On Error Goto OnError
	Ftp1.Timeout = 1000
	Ftp1.List "-lr *.txt" ' a full recursive listing of text files
	Dim ListEntry As ListEntry
	For Each ListEntry In Ftp1.Listing
		Text2.Text = ListEntry.Name & vbCrLf ' show all names to user
	Next
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub
See Also

Ftp Object  | Ftp Members


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