Usage examples
File Download example
This example demonstrates download a remote file called MyFile.txt from a folder called MyRemoteFolder into a local file MyFile.txt.
The remote files will be located in a directory that has been provisioned for you on the remote FTS server. This remote directory can be referred to as your root directory "/", with any subdirectories or files you have created located within this. For example, if you have a file "MyFile.txt" in a folder called "MyFolder" then you'd refer to this using the remote path "/MyFolder/MyFile.txt".
model FacFileTransferExample uses "facfiletransfer" parameters USER="MyFTSUsername" PASS="MyFTSPassword" end-parameters declarations LOCAL_FILE="MyFile.txt" REMOTE_FILE="/MyRemoteFolder/MyFile.txt" end-declarations ! Login to file transfer service facftlogin(USER,PASS) ! Download remote file facftdownload(REMOTE_FILE,LOCAL_FILE) end-model
File Upload example
This example demonstrates upload from a text object in the model to the remote path /MyRemoteFolder/MyFile.txt.
model FacFileTransferExample uses "facfiletransfer","mmsystem" parameters USER="MyFTSUsername" PASS="MyFTSPassword" end-parameters public declarations localData: text end-declarations declarations REMOTE_FILE="/MyRemoteFolder/MyFile.txt" end-declarations ! Populate data to upload localData := "Hello World" ! Login to file transfer service facftlogin(USER,PASS) ! Download remote file facftupload(REMOTE_FILE,"mmsystem.text:localData") end-model
File Listing example
This example demonstrates listing all the files in the remote folder /MyRemoteFolder.
model FacFileTransferExample uses "facfiletransfer","mmsystem" parameters USER="MyFTSUsername" PASS="MyFTSPassword" end-parameters declarations remoteFiles: list of facftfile REMOTE_FOLDER="/MyRemoteFolder" end-declarations ! Login to file transfer service facftlogin(USER,PASS) ! Request remote directory listing remoteFiles := facftlist(REMOTE_FOLDER) ! Output remote filenames forall( f in remoteFiles) do writeln(REMOTE_FOLDER,"/",f.filename) end-do end-model