OpenDirectory Method  
 

Open the specified directory on an FTP server.

Syntax

object.OpenDirectory( [DirName], [ParseList] )

Parameters

DirName
An optional string value that specifies the directory on the server. If it is an empty string, it designates the current remote directory. It may also be a file mask that includes wildcards if supported by the server. If this argument is omitted, then the current working directory will be opened.
ParseList
An optional boolean value that determines if the directory listing will be parsed as it is read. The default value is true. If the ParseList parameter is false, then each entire un-parsed line of a directory listing will be returned in the FileName parameter of the ReadDirectory method, and all other output parameters will be empty.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The OpenDirectory method opens the specified directory on the server so that the list of files in that directory may be read.

Note that you must call the CloseDirectory method after the list of files has been returned by the server. Failure to do so will result in an error when you attempt to transfer a file because the data channel to the server has been left open. For this same reason, you cannot call the GetFile or PutFile methods while reading the contents of a directory on the server.

Example

' Request a parsed directory listing.
nError = FileTransfer1.OpenDirectory(strDirName)

' Request a parsed directory listing of the current directory
nError = FileTransfer1.OpenDirectory()

' Request an un-parsed listing of files in the current directory
nError = FileTransfer1.OpenDirectory("", False)

' Request a parsed listing of files in the current directory
' with file extension .exe
nError = FileTransfer1.OpenDirectory("*.exe")

See Also

CloseDirectory Method, ReadDirectory Method