SetCurrentDirectory

SetCurrentDirectory sets the directory location on the remote ftp server. Any file functions (eg. upload or download) are relative to this directory.

Syntax

SetCurrentDirectory(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 Sets the current working directory:

Function Main

Dim FTPobj as Object

'configure as needed

ip = "127.0.0.1"

port = 21

mode = FALSE

username = "anonymous"

password = "test@lnss.com"

directory = "/pub/"

'create a new ftp Connection

Set FTPobj=FTPA protocol used to transfer files between network computers..Connect (ip,21,mode,username,password)

'Set the current working directory to /pub/

RET = FTPobj.SetCurrentDirectory (directory)

if RET Then

echo "Set current directory to " + directory + " succeeded"

else

echo "failed to Set current dir: " + CStr(FTPobj.LastError)

End If

End Function