Reputation: 191
I'm trying to remove a file from my ftp server in the command line. It looks like this:
curl -v -O ftp://192.168.26.10/inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm -Q 'DELE inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm'
The file is deleted but the output looks very strange and as I understand curl returns an error. So the output:
< 220 NASFTPD Turbo station 1.3.5a Server (ProFTPD)
> USER anonymous
< 331 Anonymous login ok, send your complete email address as your password
> PASS [email protected]
< 230 Anonymous access granted, restrictions apply
> PWD
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0< 257 "/" is the current directory
* Entry path is '/'
> DELE inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm
* ftp_perform ends with SECONDARY: 0
< 250 DELE command successful
> CWD inbox
< 250 CWD command successful
> CWD project
< 250 CWD command successful
> CWD logs
< 250 CWD command successful
> CWD video
< 250 CWD command successful
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||55808|)
* Hostname was NOT found in DNS cache
* Trying 192.168.26.10...
* Connecting to 192.168.26.10 (192.168.26.10) port 55808
* Connected to 192.168.26.10 (192.168.26.10) port 21 (#0)
> TYPE I
< 200 Type set to I
> SIZE super_user_2017-09-25_19-20-27.webm
< 550 super_user_2017-09-25_19-20-27.webm: No such file or directory
> RETR super_user_2017-09-25_19-20-27.webm
< 550 super_user_2017-09-25_19-20-27.webm: No such file or directory
* RETR response: 550
* Remembering we are in dir "inbox/project/logs/video/"
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Connection #0 to host 192.168.26.10 left intact
curl: (78) RETR response: 550
What is wrong with my command? Thanx a lot!
Upvotes: 2
Views: 4298
Reputation: 191
I understood what was the problem, so I will try to answer my own question. I changed a little bit the command. So now it looks like this
curl -v ftp://192.168.26.10/inbox/project/logs/video -Q"DELE /inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm"
/inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm
is the full path to the file you are trying to delete.
is the directory that contains the file. After deleting the file curl runs LIST command on the remote server to show that the file was successfully deleted. It's like deleting the file in Midnight Commander. You delete the file and it automatically refreshes the directory for you. My mistake was that I used not the directory but the file itself
ftp://192.168.26.10/inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm
So after deleting curl checks if the file was successfully deleted and runs RETR on the ftp server. And gets the error trying to retrieve this file cause it doesn't already exists.
Upvotes: 2