Passing -f with rm command in sftp

Is there any way I can pass -f with rm command in sftp? If I use it it treats -f as a file name to be removed.


sftp> rm -f abcd
Couldn't stat remote file: No such file or directory
Removing /home/sdesai/-f
Couldn't delete file: No such file or directory
sftp> "rm -f" abcd
Invalid command.
sftp> rm \-f abcd
Couldn't stat remote file: No such file or directory
Removing /home/sdesai/-f
Couldn't delete file: No such file or directory
sftp>

The -f (--force) option, although abvailable for the OS rm command, does NOT - as per man sftp - exist for sftp 's "interactive commands". Which is in accord with your observations above.

if you have ssh keys set up and permissions on the file, an alternate:

ssh username@remote 'rm -f /path/to/remote/file'