CreateDirectory

CreateDirectory creates a new directory on the remote ftp server.

Syntax

CreateDirectory(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)

'initialize 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=FTPA protocol used to transfer files between network computers..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