How do you delete a file over SFTP with CURLSMBS?

I’m trying to use MonkeyBread’s CURLSMBS plugin to delete a file on my server via SFTP but keep getting the following curl error:

CURLSMBS.kError_WRITE_ERROR
Failed writing body (0 != 61)

There is no example for SFTP deletion in the MBS examples folder (there is one for FTP).

Here is the code I am using:

[code] ’ Set up the file deleter
dim curl as new CURLSMBS
curl.OptionVerbose = True
curl.OptionUsername = kSFTPUsername
curl.OptionPassword = kSFTPPassword
curl.OptionURL = “sftp://” + kServerIP + “/”
commands.Append("rm " + kPathStorage + “/” + imageName)
curl.SetOptionPostQuote(commands)

’ Use this curl instance to delete this file (if it exists)
err = FileSystem.curl.Perform()[/code]

The constants provided above are correct (including the paths) as I am using them elsewhere in the app to upload files over SFTP to the same server successfully.

Not sure what the error about ‘failed writing body’ means since this is a deletion command not a write command.

Does anyone with more knowledge about SFTP or CURL understand this??

Seems like you have no code in events.
So maybe you add

curl.CollectDebugData = true
curl.CollectHeaderData = true
curl.CollectOutputData = true

so the plugin collects the output.
Because if server sends something like directory listing, we need to process it.

Try removing OptionsVerbose = True
Use Uppercase RM instead of rm

dim curl as new CURLSMBS
//curl.OptionVerbose = True
curl.OptionUsername = kSFTPUsername
curl.OptionPassword = kSFTPPassword
curl.OptionURL = “sftp://” + kServerIP + “/”
commands.Append("RM " + kPathStorage + “/” + imageName)
curl.SetOptionPostQuote(commands)

’ Use this curl instance to delete this file (if it exists)
err = FileSystem.curl.Perform()

Regards,
Val

Does it work now?

curl.CollectDebugData = true
curl.CollectHeaderData = true
curl.CollectOutputData = true

Just tested it now. Works perfectly. Thanks a lot.