Dart Ftp Control
Directory Property
Description
Working directory on the server.
Property type
Read-write property
Syntax
Visual Basic
Public Property Directory As String
Remarks

After the client logs in with the Login method, this property sets or returns the working directory. If not logged in, an empty string is returned.

The value is set or returned on demand. Upon completion of the Login method and the ChangeDirectoryUp method, the actual value is unknown. When the value of this property is known, it is immediately returned without checking the server.

When this property is read and the value is unknown, a blocking ftpPrintDirectory command retrieves the value from the server. The Blocked property is True while this information is retrieved (a ptTimeout error will be thrown if the server does not respond within 30 seconds).

When this property is set, a blocking ftpChangeDirectory command is sent to the server. The Blocked property is True while this occurs (a ptTimeout error will be thrown if the server does not respond within 30 seconds). After setting this property the actual value on the server is unknown, so a blocking ftpPrintDirectory command is sent the next time this property is read.

If non-blocking operation is desired, you can set the Timeout property to 0 and:

Note: Use error handling, since this property can return a run-time error.

Note: Reading or setting this property may cause the Progress Event to fire while blocking, so you will not be able to use other methods from within this event.

Error Codes

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

Example
Private Sub cmdDirectoryTest_Click()
' this shows directory manipulation using the Ftp Control
' login to the ftp server
Ftp1.Login "www.testserver.com", "Administrator", "123456"
' print current directory, should be '/'
Debug.Print Ftp1.Directory
' create a new directory
Ftp1.MakeDirectory "tempdir"
' set directory to newly created dir
Ftp1.Directory = "tempdir"
' print current directory, should be '/tempdir'
Debug.Print Ftp1.Directory
' change back to parent dir
Ftp1.ChangeDirectoryUp
' print current directory, should be '/'
Debug.Print Ftp1.Directory
' delete directory
Ftp1.RemoveDirectory "tempdir"
' attempt to change to deleted dir will result in error
Ftp1.Directory = "tempdir" ' !error
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