possible to delete file from fetch

So I have a file on a mikrotik server. The mikrotik client will connect to server download the file and run the config and delete the file locally. What I want to see is if it can also somehow delete the file on the ftp server mikrotik.

Or is this something I will need to get the server to do?

Here is the code I have as you can see the name of the file is a variable based off the identity of the box.

:global cbname “$[/system identity get name]”
/tool fetch address=[:resolve xxx.xxx.xxx] src-path=[:put ($cbname . “.rsc”)] user=xxxxxxx password=xxxxxxx port=xxxxxxx mode=ftp keep-result=yes
/delay 5s
/import [:put ($cbname . “.rsc”)]
/delay 5s
/file remove [:put ($cbname . “.rsc”)]
/tool e-mail send to=xxxxxxxxxxxxxxxxx subject=“$[/system identity get name] [Script Updated]” body="Date: $[/system clock get date]: System has been enabled

Thanks

Still trying to figure out the above anyone have ideas?

I have now come up with this but it still copies the file down does not delete it

/tool fetch address=[:resolve xxxx.xxxx.xxx] user=xxxxxx password=xxxxx port=xxxxx mode=ftp http-method=delete src-path=($cbname . “.rsc”)

You can’t really use FTP together with HTTP-METHOD. the HTTP-METHOD is commonly used for REST API to distinct different methods on same resource/object (deleting, viewing, updating …)

The fetch command does not have such functionality, so you cannot delete the file. You might, however, connect to remote mikrotik via ssh (telnet will not work - it is interactive only) and delete the file remotely, for example like this:

/system ssh 192.168.1.1 user=admin "/file remove FILENAME.rsc";

(obviously you have to set up keys for SSH connection first and correctly edit the code to put your filename)