FTP delete not working via WinSCP 4.2.7 explorer interface


Manchester UK

FTP delete not working via WinSCP 4.2.7 explorer interface

winscp v 4.2.7 running on windows 2003 r2 enterprise edition server with SP2 connecting to a WS_FTP Server 7.1(97000000)

I'm logging on to a FTP server (standard FTP - no encryption) and I can successfully put/get files to the server. Problems arise when I try a delete operation - I get an error dialogue box stating "error deleting file '<name of file>'" with 'deletion failed' within the detail box. I've tried connecting in both passive and active ftp and get the same result. I also get the same thing if I try it from a winscp console session (eventually I want to script it):-

winscp> option batch on
batch on
winscp> option confirm off
confirm off
winscp> open ftp://username1:password@ftpserver
Connecting to ftpserver ...
Connected with ftpserver. Waiting for welcome message...
Starting the session...
Reading remote directory...
Session started.
Active session: [1] username1@ftpserver
winscp> cd /test/upload/HRMS_Australia
winscp> ls
D--------- 0 0 ..
-rwxr-x--- 0 username System 25 Apr 21 18:14 testfile.dat
winscp> rm testfile.dat
Error deleting file 'testfile.dat'.
Deletion failed
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort

I'm beginning to think that its because the permissions on the ls state 'username' and not 'username1' - does winscp query this??? (I wouldnt have thought so?)

What DOES work is Microsoft Windows 2003 Server native ftp client:-

C:\Documents and Settings\userid>ftp ftpserver
Connected to ftpserver.
220 ftp4.xxxxxxx.net X2 WS_FTP Server 7.1(97000000)
User (ftp.xxxxxxxxx.com:(none)): username
331 Enter password
230-User logged in
Welcome to ftp4.xxxxxxxx.net
230 User logged in
ftp> cd /test/upload/HRMS_Australia
250 Command CWD succeed
ftp> ls
200 Command PORT succeed
125 Transferring directory
226 Transfer completed
ftp: 14 bytes received in 0.00Seconds 14000.00Kbytes/sec.
ftp> delete testfile.dat
250 deleted
ftp> ls
200 Command PORT succeed
125 Transferring directory
226 Transfer completed

I've checked with the FTP server owner and they say no probs when they logon to the server with the same account and delete the same file.... (just as I do with the Windows native ftp client)

Here's a portion of the winscp log (in debug2 mode) relating to the delete operation (I've altered it slightly since the username is present which reveals the company name the account is used for)

. 2010-04-21 18:45:39.740 Cached directory change via "HRMS_Australia" to "/test/upload/HRMS_Australia".
. 2010-04-21 18:45:39.787 Getting current directory name.
. 2010-04-21 18:45:39.787 Retrieving directory listing...
> 2010-04-21 18:45:39.787 CWD /test/upload/HRMS_Australia/
< 2010-04-21 18:45:39.818 250 Command CWD succeed
> 2010-04-21 18:45:39.818 PWD
< 2010-04-21 18:45:39.834 257 "/test/upload/HRMS_Australia" is current directory
> 2010-04-21 18:45:39.834 TYPE A
< 2010-04-21 18:45:39.850 200 Transfer mode set to ASCII
> 2010-04-21 18:45:39.850 PORT 10,16,1,106,18,119
< 2010-04-21 18:45:39.865 200 Command PORT succeed
> 2010-04-21 18:45:39.865 LIST -a
< 2010-04-21 18:45:39.897 125 Transferring directory
. 2010-04-21 18:45:39.897 drwxr-x--- 2 username System 0 Apr 21 18:44 .
. 2010-04-21 18:45:39.897 drwxr-x--- 2 username System 0 Mar 01 2010 ..
. 2010-04-21 18:45:39.897 -rwxr-x--- 1 username System 25 Apr 21 18:44 testfile.dat
< 2010-04-21 18:45:39.897 226 Transfer completed
. 2010-04-21 18:45:39.897 Directory listing successful
. 2010-04-21 18:45:39.897 Got reply 1 to the command 2
. 2010-04-21 18:45:40.318 Session upkeep
. 2010-04-21 18:45:40.365 Session upkeep
. 2010-04-21 18:45:40.865 Session upkeep
. 2010-04-21 18:45:41.365 Session upkeep
. 2010-04-21 18:45:41.865 Session upkeep
. 2010-04-21 18:45:42.365 Session upkeep
. 2010-04-21 18:45:42.865 Session upkeep
. 2010-04-21 18:45:43.365 Session upkeep
. 2010-04-21 18:45:43.787 Deleting file "testfile.dat".
> 2010-04-21 18:45:43.819 DELE /test/upload/HRMS_Australia/testfile.dat
< 2010-04-21 18:45:43.834 450 Deletion failed
. 2010-04-21 18:45:43.834 Got reply 1 to the command 32
. 2010-04-21 18:45:43.850 Asking user:
. 2010-04-21 18:45:43.850 Error deleting file 'testfile.dat'. ("Deletion failed")
. 2010-04-21 18:45:43.975 Session upkeep
. 2010-04-21 18:45:44.365 Session upkeep
. 2010-04-21 18:45:44.865 Session upkeep
. 2010-04-21 18:45:45.365 Session upkeep
. 2010-04-21 18:45:45.865 Session upkeep

Any ideas?

Reply with quote


Re: FTP delete not working via WinSCP 4.2.7 explorer interface

issue was with the filename winscp uses to delete the file...

winscp issues a dele command with the filename as a parameter - if the file is in /folder1/temp/file.txt, then a parameter is "/folder1/temp/file.txt". Using Microsoft FTP client if you cd to the same folder and issue a dele file.txt, the parameter passed is "file.txt". Using MS FTP client if I issue the same command as winscp does (dele /folder1/temp/file.txt) - this results in the the following in the winscp log:-

> 2010-04-22 14:09:08.767 DELE /test/download/HRMS_Australia/testfile.dat
< 2010-04-22 14:09:08.830 450 Deletion failed

Seems to be a problem specific to WSFTP Server - I'm only paraphrasing the WSFTP support guys email that he sent back to me:-

<partial log entry from wsftp server:-
Line 133663: 2010-04-22 13:08:51 User.Error commsgateway1 Apr 22 14:08:53 LAZYORANGE FTP: Failed to remove /test/download/HRMS_Australia/testfile.dat <Host=ftp4.kewill.net, SessionID=09606658, Listener=x.x.x.x:21, Client=x.x.x.x:4483, User=username><Command=DELE, Parameters=/test/download/HRMS_Australia/testfile.dat, Error=450>

This is showing that they are unusually using the full path when they delete the file, the FTP server can either hide or show the root of the path, in this case the root is folder12, so the real path is infact /folder12/test/download/HRMS_Australia/testfile.dat, so I have switch this account to show the root folder, so you will now see the full path, this will fix the issue.

Hope the above makes sense??? To the developer(s) of Winscp - would it be possible to include an option to not sent the full file path (I tried it in console mode, but winscp seems to insist on sending the full path of the file to be deleted)...?

Reply with quote

Site Admin
martin avatar
Prague, Czechia

Re: FTP delete not working via WinSCP 4.2.7 explorer interface

Thanks for your post. This issue is being tracked already.
Martin Prikryl

Reply with quote


You can post new topics in this forum