I'm trying to delete a file on a remote path via ssh, the command I'm trying to use from my local computer is using bash and my remote computer uses cmd.
I'm trying to use the following command:
ssh user@host "del -f F:\\some\\path\\in\\remote\\1.computer\\1.filename.txt"
and in the logs I get the following error: The filename, directory name, or volume label syntax is incorrect
Any feedback will be well appreciated.
Thanks!
Edit: Important note I forgot to mention is I'm using a spawn command via a script to execute the ssh instruction
Your problem is related to backslashes. You need to escape a backslash with another one, but you need four backslashes at the first position so it will be evaluated as two backslashes:
ssh user@host "del -f F:\\\\some\\path\\in\\remote\\1.computer\\1.filename.txt"