07.04 - Build-in shortcuts (macros)



# FTP_DOWNLOAD {remotePath} FROM {FTPserverTarget} AS {downloadedResourceName}

What: This macro will download a resource from a FTP server. 

# FTP_DOWNLOAD {remotePath} FROM {FTPserverTarget} AS {downloadedResourceName}
=>

EXECUTE get WITH $() ON {FTPserverTarget} USING $(remotepath : {remotePath}) AS {downloadedResourceName}

Input:

  • {FTPserverTarget}: The name (in the context) of the FTP server to use. (Target of category ftp.target)
  • {remotePath}: It corresponds to the file path on the FTP server, relatively to the home directory of the file you want to get.
  • {downloadResourceName}: The name of the resource which references the file you download on the FTP server (Resource of type file).

Example:

# FTP_DOWNLOAD path/to/toto.txt FROM my-ftp-server AS toto.file


# FTP_UPLOAD {localResourcePath} ONTO {FTPserverTarget} USING REMOTE PATH {remotePath}

What: This macro will upload a resource on a FTP server. 

# FTP_UPLOAD {localResourcePath} ONTO {FTPserverTarget} USING REMOTE PATH {remotePath}
=>

LOAD {localResourcePath} AS __temp_{%%rand1}.file
EXECUTE put WITH __temp_{%%rand1}.file ON {FTPserverTarget} USING $(remotepath : {remotePath}) AS {{whocares}}

Input:

  • {FTPserverTarget}: The name (in the context) of the FTP server to use. (Target of category ftp.target)
  • {localResourcePath}: The path of the file you want to upload on the FTP server.
  • {remotePath}: It corresponds to the file path on the FTP server, relatively to the home directory of the file you want to put.

Example:

# FTP_UPLOAD path/to/toto.txt ONTO my-ftp-server USING REMOTE PATH abc/name.txt


# FTP_DELETE {remotePathOfFileToDelete} FROM {FTPserverTarget}

What: This macro will delete a file on a FTP server.

# FTP_DELETE {remotePathOfFileToDelete} FROM {FTPserverTarget}
=>

EXECUTE delete WITH $() ON {FTPserverTarget} USING $(remotepath : {remotePathOfFileToDelete}) AS {{whocares}}

Input:

  • {FTPserverTarget}: The name (in the context) of the FTP server to use. (Target of category ftp.target)
  • {remotePathOfFileToDelete}: It corresponds to the file path on the FTP server, relatively to the home directory of the file you want to delete.

Example:

# FTP_DELETE distant/path/toto.txt FROM my-ftp-server


# FTP_DELETE_IF_EXISTS {remotePathOfFileToDelete} FROM {FTPserverTarget}

What: This macro will delete a resource on a FTP server. If the file doesn't exist, the macro doesn't fail.

# FTP_DELETE_IF_EXISTS {remotePathOfFileToDelete} FROM {FTPserverTarget}
=>

EXECUTE delete WITH $() ON {FTPserverTarget} USING $(remotepath : {remotePathOfFileToDelete},failIfDoesNotExist:false) AS {{whocares}}

Input:

  • {FTPserverTarget}: The name (in the context) of the FTP server to use. (Target of category ftp.target)
  • {remotePathOfFileToDelete}: It corresponds to the file path on the FTP server, relatively to the home directory of the file you want to delete.

Example:

# FTP_DELETE_IF_EXISTS distant/path/toto.txt FROM my-ftp-server