Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All


FTPCwd (socket,newdirReturns status


Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded,allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

FTPCwd changes the working directory for the specified FTP connection.

Socket is an Omnis Long Integer field containing a socket opened to an FTP server using FTPConnect.

NewDir is an Omnis Character field containing the new working directory. The contents of this string are system-dependent. FTPCwd accepts anything for this argument, but the remote FTP server may not. Most FTP servers accept Linux-style path and file specifications with path and file separated by slashes, such as


Most FTP servers accept the Linux conventions for abbreviations for special directory specifications, that is, ".." for the next higher sub-directory, and "~userid" for the home directory of a particular user ID.

Some FTP servers also accept system-specific directory path formats, that is, Macintosh colon-separated as in Macintosh HD:My Folder:My File or VMS-style path and file specifications, as in SOME$DISK:[USER.SUBDIRECTORY]FILENAME.EXTENSION;1.

Consult the documentation for the server to determine the authoritative acceptable directory path specifications. When in doubt, try the Linux style.

Status is an Omnis Long Integer field which receives the result of executing the command. Possible error codes are listed in the Web Command Error Codes Appendix.


Calculate lNewDirectory as '../testFolder'

FTPCwd (iFTPSocket,lNewDirectory) Returns lErrCode
If lErrCode
  OK message FTP Error {[con("Error setting FTP directory",kCr,"Error code : ",lErrCode)]}
End If