Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Can't delete file on FTP host

What version of WinSCP are you using?
byteguy

Can't delete file on FTP host

Trying to call WinSCP in pure command-line mode to replace Windows FTP in an old system that needs to run with passive FTP now.

I've got it working for sending, receiving, and listing files. But I just can't get it deleting on the host.

I write a script file and then fire off WinSCP with:

winscp /script=tempftp.scr /log="null.txt"

First tried "RM" like this:

option echo off
option confirm off
open ftp://user:password@host.com -passive
cd database
rm marker.txt
close
exit

The file was left and the log showed

. 2010-04-05 23:19:39.680 Getting current directory name.
. 2010-04-05 23:19:39.680 Deleting file "marker.txt".
> 2010-04-05 23:19:39.680 DELE /database/marker.txt
< 2010-04-05 23:19:39.711 450 Deletion failed
. 2010-04-05 23:19:39.711 Asking user:
. 2010-04-05 23:19:39.711 Error deleting file 'marker.txt'.("Deletion failed")

Then tried a "get -delete" (renamed on download side to avoid collision since I intend to delete, confirm with LS and then send updated file)

option echo off
option confirm off
open ftp://user:password@host.com -passive
cd database
get -delete marker.txt null.fil
close
exit

This got the file, saved it with the new name, but didn't delete. The log showed:

. 2010-04-05 23:05:44.820 Deleting file "/database/marker.txt".
> 2010-04-05 23:05:44.820 DELE /database/marker.txt
< 2010-04-05 23:05:44.852 450 Deletion failed
. 2010-04-05 23:05:44.852 Asking user:
. 2010-04-05 23:05:44.852 Error deleting file '/database/marker.txt'. ("Deletion failed")

What am I missing here?