Xbasic
ftp_delete Function
Syntax
c ftp_delete(c address, c user, c password, c path)
Arguments
- addressCharacter
FTP server address or host name (for example, ftp.example.com).
- userCharacter
Username used to authenticate with the FTP server.
- passwordCharacter
Password for the specified user account.
- pathCharacter
Remote file path to delete. Can be absolute or relative to the login directory. This can include wildcards to delete multiple files.
Returns
- resultCharacter
"Success" if the operation completed successfully; otherwise an error description.
Description
Delete a file from a remote FTP server at the specified path. Returns a status string indicating success or failure.
Example
Delete a file on an FTP server
dim server as c = "ftp.example.com"
dim username as c = "deploy"
dim password as c = "s3cr3t"
dim remote as c = "/incoming/archive.zip"
dim status as c
status = ftp_delete(server, username, password, remote)
if status = "OK" then
? "File deleted."
else
? "Delete failed: " + status
end ifNotes
- Ensure the account has permission to delete the target file.
- Paths are interpreted by the server; use the correct directory separators for your FTP server.
- If the file does not exist, the server typically returns an error string.