FTP Plugin - Macros


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

What ?

This macro will download a resource from a FTP server.

Underlying instruction :

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

> Input :

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

Example :

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

.properties file which contains FTP information :

../../_images/ftp-macro-ftp-properties-file.png

.properties must be in “targets” folder of your project :

../../_images/ftp-macro-ftp-properties-file-location.png

SKF script :

../../_images/ftp-download-macro.png

FTP confirms that the example.txt has been downloaded :

../../_images/ftp-download-macro-ftp-interface.png

You can see the downloaded file in SQUASH_TA temporary files folder :

../../_images/ftp-download-macro-result.png

Here is the downloaded file :

../../_images/ftp-download-macro-temp-file.png


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

What ?

This macro will download an ASCII type resource from a FTP server.

Underlying instruction :

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

> Input :

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

Example :

# FTP_DOWNLOAD ASCII FILE path/to/example.txt FROM my-ftp-server AS example.file

This example is based on the first one. For more details, please check here.

SKF script :

../../_images/ftp-download-ascii-macro.png

FTP transfer mode is set to ASCII :

../../_images/ftp-download-ascii-macro-result.png


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

What ?

This macro will download a binary type resource from a FTP server.

Underlying instruction :

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

> Input :

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

Example :

# FTP_DOWNLOAD BINARY FILE path/to/example.bin FROM my-ftp-server AS example.file

This example is based on the first one. For more details, please check here.

SKF script :

../../_images/ftp-download-binary-macro.png


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

What ?

This macro will upload a resource on a FTP server.

Underlying instructions :

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

> Input :

  • {localResourcePath} : The path of the file you want to upload on the FTP server.
  • {FTPserverTarget} : The name (in the context) of the FTP server to use (ftp.target type target)
  • {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/example.txt ONTO my-ftp-server USING REMOTE PATH abc/name.txt

File to upload :

../../_images/ftp-upload-macro-example-file.png

File location :

../../_images/ftp-upload-macro-example-file-location.png

.properties file which contains FTP information :

../../_images/ftp-macro-ftp-properties-file.png

.properties must be in “targets” folder of your project :

../../_images/ftp-macro-ftp-properties-file-location.png

SKF script :

../../_images/ftp-upload-macro.png

FTP confirms that the uploadExample.txt has been uploaded :

../../_images/ftp-upload-macro-ftp-interface.png
../../_images/ftp-upload-macro-ftp-interface2.png


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

What ?

This macro will upload an ASCII type resource on a FTP server.

Underlying instruction :

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

> Input :

  • {localResourcePath} : The path of the file you want to upload on the FTP server.
  • {FTPserverTarget} : The name (in the context) of the FTP server to use (ftp.target type target)
  • {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 ASCII FILE path/to/example.txt ONTO my-ftp-server USING REMOTE PATH abc/name.txt

This example is based on the previous one. For more details, please check here.

SKF script :

../../_images/ftp-upload-ascii-macro.png

FTP transfer mode is set to ASCII :

../../_images/ftp-upload-ascii-macro-result.png


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

What ?

This macro will upload a binary type resource on a FTP server.

Underlying instruction :

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

> Input :

  • {localResourcePath} : The path of the file you want to upload on the FTP server.
  • {FTPserverTarget} : The name (in the context) of the FTP server to use (ftp.target type target)
  • {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 BINARY FILE path/to/example.bin ONTO my-ftp-server USING REMOTE PATH abc/name.bin

This example is based on the previous one. For more details, please check here.

SKF script :

../../_images/ftp-upload-binary-macro.png


# FTP_DELETE {remotePathOfFileToDelete} FROM {FTPserverTarget}

What ?

This macro will delete a file on a FTP server.

Underlying instruction :

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

> Input :

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

Example :

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

.properties file which contains FTP information :

../../_images/ftp-macro-ftp-properties-file.png

.properties must be in “targets” folder of your project :

../../_images/ftp-macro-ftp-properties-file-location.png

SKF script :

../../_images/ftp-delete-macro.png

FTP confirms that the file has been deleted :

../../_images/ftp-delete-macro-ftp-interface.png


# 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.

Underlying instruction :

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

> Input :

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

Example :

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

This example is similar to the previous one. For more details, please check here.