Deleteing a file from a remote server

I need to delete a file from a ftp server but have the username and password in the command. I tried using curl but it wasn’t working but i don’t really know curl.
Any help is appreciated

Hello!

I have not used this ftpclient, but I own interarchy, and I guess they are about the same.

you should easily be able to script Cyberduck with Applescript, maybe you won’t feel the big need, when you realize all the pain you have just lost! :smiley:

Cyberduck can be found herehere

Script examples can be foundHere and by google. I think Cyberduck has been a popular ftp client for many years, and it is scriptable, with an unbeatable price! (free).

Is there any other way to do it without having to install another application like through terminal or any other means

Hello!

Yes, ftp is originally something to be used from a terminal, so it shouldn’t be to great a problem.

Another idea I have, is to log on via Finder, and delete the file via an applescript there, I am not sure if that is possible, but it is certainly worth trying.

I have to look into this, because I have actually never scripted connections to ftp servers from Finder, and I have no idea about what kind of rights you then are granted.

But you’ll have to set up an ftp, or sftp client and make that working, in order to use your terminal, or telnet, for that matter. (Though I am not sure if telnet is supported anymore.) On windows, I know there is a program putty I wonder if there is a similiar on mac.)

Anyway, by installing an application, you’ll live more painless, if not logging in via finder, and managing to delete it from there isn’t simple enough.

Ok. Tell me if you find anything

IMHO this is one of the areas, where you either study or buy.

it is not that difficult at all when you can do it, if you for instance can manage to make a shell script, making the connection for you, having set up ssh and such, but if you can’t do those things, then you either have to study and do it while you read how tos, and you’ll have to spend at least 5 hours in setting it up.

Or you can buy or donate to cyberduck or interarchy.

Or you can log onto your ftp drive from finder, which is basically two keystrokes and delete the file from there.

I think that is your options.

See my examples here and herewhere you can send remote commands over SSH by using do shell script without installing certificates.

DJ Bazzie Wazzie I don’t have access to my machine right now but by what you can see will this remove the file from the server listed above

set sshUser to "user"
set sshPasswd to "password"
set sshServer to "1.1.1.1"
set externalCommand to "rm /home/amsterdam/JarvisData/1865673/message.txt"


set thecommand to "(echo \"spawn ssh"
set thecommand to thecommand & " " & sshUser & "@" & sshServer
set thecommand to thecommand & " " & externalCommand & "\" ;"
set thecommand to thecommand & "echo \"expect {\" ;"
set thecommand to thecommand & "echo \"\\\"Password:\\\" {send \\\""
set thecommand to thecommand & sshPasswd
set thecommand to thecommand & "\\\\r\\\" ; exp_continue }\" ;"
set thecommand to thecommand & "echo \"\\\"yes/no?\\\" {send \\\"yes\\\\r\\\" ; exp_continue }\" ;"
set thecommand to thecommand & "echo \"eof\" ;"
set thecommand to thecommand & "echo \"}\" ;"
set thecommand to thecommand & ") | expect"

do shell script thecommand

Yes it should remove the file. the expect command is case sensitive so it is ‘Password:’ or ‘password:’ depending on the machine.

Ok thanks a lot :smiley: