RemoveDirectory

RemoveDirectory deletes a directory on the remote FTPA protocol used to transfer files between network computers. server.

Syntax

RemoveDirectory(STRING directory)

Where:

  • Directory is a string.
Returns

Boolean. If it returns TRUE, the function has succeeded, otherwise it means that and error was returned. When FALSE is returned, FTPObject.LastError will return the WIN32 error code.

Example

An example which echoes the current ftp working directory:

Function Random(N)

Random = Int(N*Rnd)

End Function

Function Main

Dim FTPobj as Object

'configure as needed

ip = "127.0.0.1"

port = 21

mode = FALSE

username = "anonymous"

password = “test@lnss.com”

cr = Chr(13) + Chr(10)

'initialise randomization

Randomize

'now generate a random number to be added to the filenames

for K = 1 to 10

randomnumber = randomnumber + cstr(Random(10))

next

tempDir = "lnssDir" & randomnumber

'create a new ftp Connection

Set FTPobj=FTP.Connect (ip,21,mode,username,password)

'attempt to create a new directory after an anonymous ftp Connection

if FTPobj.CreateDirectory ( tempDir ) = TRUE then

echo "Directory create access is available to anonymous ftp at " + ip & cr

'now attempt to Delete the directory

if FTPobj.RemoveDirectory ( tempDir ) = TRUE then

echo "Directory Delete access is available to anonymous ftp at " + ip & cr

else

echo "Directory Delete access is not available. You might need to Delete directories created by GFI LanGuard" & cr

End If

End If

End Function