Ftp Object : RemoveDirectory Method |
Visual Basic |
---|
Public Sub RemoveDirectory( _ ByVal PathName As String _ ) |
Sends the ftpRemoveDirectory command.
If Timeout is greater than 0, this method blocks until a reply is received from the server or a ptTimeout error occurs. If Timeout is 0, this method immediately returns and the Progress event fires with FtpCmd = ftpRemoveDirectory when the reply is received.
This method may generate the following error code (refer to ErrorConstants for a complete list of error codes):
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