Check if file or folder exists on FTP server
The “Check if file/folder exists on FTP server” service task verifies whether a specific file or folder is present on an FTP server. Use it to ensure that a target directory exists before starting additional operations such as uploads or downloads.
Input parameters
Provide the following fields as task input:
{
"FTPAccess": {
"host": "ftp.example.com",
"user": "username",
"password": "password"
},
"pathToCheck": "/folder/file.txt"
}
Explanation:
FTPAccess
: Credentials for the FTP server (host, username, and password).pathToCheck
: Full path to the file or folder you want to verify.
Output
The task returns whether the specified path exists on the FTP server:
{
"status": 200,
"path": "/folder/file.txt",
"exists": true
}
Explanation:
status
: HTTP-like status code;200
indicates a successful check.path
: The path that was verified.exists
: Indicates whether the path exists (true
) or not (false
).
JSONata examples
- Set path dynamically:
jsonata
{
"FTPAccess": {
"host": "ftp.example.com",
"user": "username",
"password": "password"
},
"pathToCheck": "concat('/invoices/', $customer_id, '.pdf')"
}
- Check whether a folder exists:
jsonata
{
"FTPAccess": {
"host": "ftp.example.com",
"user": "username",
"password": "password"
},
"pathToCheck": "/backup"
}
Notes
- The task can check both files and folders.
- Provide the full path, e.g.,
/folder/file.txt
. - If the path does not exist,
exists
will befalse
.
Tip
Use the output in subsequent process steps to branch actions based on the path’s existence – for example, upload files or process existing documents.