Delete a file from an ftp
Function: Delete a file from an FTP
This action allows you to remove a specific file from an FTP (File Transfer Protocol) server that you have previously connected to using the 'Connect to FTP' action. It's useful for cleaning up old files, managing storage, or automating file lifecycle processes on your FTP server.
Input
- File: The specific file you wish to delete from the FTP server. This must be a file that was previously retrieved or created on the connected FTP server.
Output
- STATUS: A text value indicating the outcome of the deletion attempt.
SUCCESS: The file was successfully deleted from the FTP server.CONNECTION_FAILED: There was an issue connecting to the FTP server, preventing the deletion.- If any other error occurs during the deletion process, an error message will be generated by the platform.
Execution Flow
Real-Life Examples
Here are some scenarios demonstrating how to use the "Delete a file from an FTP" action:
Example 1: Cleaning up daily reports
Imagine you have an automated process that uploads daily sales reports to an FTP server. After a week, you want to delete older reports to save space.
- Inputs:
- File: A variable named
OldSalesReportwhich holds the reference to a specific report file (e.g.,sales_report_2023-01-01.csv) on your FTP server. ThisOldSalesReportwould have been obtained from a previous action like "List files from FTP" or "Get file from FTP".
- File: A variable named
- Result: The
sales_report_2023-01-01.csvfile is removed from the FTP server, and theSTATUSoutput variable will containSUCCESS.
Example 2: Removing a temporary file after processing
You've downloaded a temporary configuration file from an FTP server, processed its contents, and now you want to delete the original temporary file from the server.
- Inputs:
- File: A variable named
TempConfigFilewhich holds the reference to the temporary configuration file (e.g.,temp_config.json) on your FTP server. ThisTempConfigFilewould have been obtained from a "Get file from FTP" action.
- File: A variable named
- Result: The
temp_config.jsonfile is deleted from the FTP server, and theSTATUSoutput variable will containSUCCESS.
Example 3: Handling a failed file upload
If a previous action attempted to upload a file to the FTP server but failed, leaving a partial or corrupted file, you might want to delete it before retrying the upload.
- Inputs:
- File: A variable named
CorruptedUploadFilewhich holds the reference to the partially uploaded file (e.g.,large_data_transfer.zip) on your FTP server. ThisCorruptedUploadFilewould be identified by a previous action.
- File: A variable named
- Result: The
large_data_transfer.zipfile is removed from the FTP server. If the FTP connection was lost during the deletion attempt, theSTATUSoutput variable might containCONNECTION_FAILED. If successful, it will containSUCCESS.