You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Ha...@voestalpine.com on 2010/02/08 08:42:25 UTC

Overwrite existing files

Hello,
 
how can I tell the embedded FTP-Server to overwrite existing files. I always get errors like this:
 
176406 [pool-2-thread-3] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - RECEIVED: RNTO status.txt
176421 [pool-2-thread-3] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - SENT: 553 Can't rename file.
 
If I delete status.txt the transmission works one time. Then the file exists again and I get the same error message.
I can't change the programm that sends the files. Is there a way to allow the RNTO command to delete the existing
file before renaming?

mit freundlichen Grüssen / with kind regards 

____________________________ 

Hannes Ditz
Hytronics EHP1

VAE Eisenbahnsysteme GmbH 
Alpinestraße 1 
8740 Zeltweg, Austria 

hannes.ditz@voestalpine.com 
www.voestalpine.com/vae <http://www.voestalpine.com/vae> 

voestalpine - One step ahead. 

 

 

Re: Overwrite existing files

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Feb 8, 2010 at 8:42 AM,  <Ha...@voestalpine.com> wrote:
> how can I tell the embedded FTP-Server to overwrite existing files. I always get errors like this:
>
> 176406 [pool-2-thread-3] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - RECEIVED: RNTO status.txt
> 176421 [pool-2-thread-3] INFO org.apache.ftpserver.listener.nio.FtpLoggingFilter - SENT: 553 Can't rename file.
>
> If I delete status.txt the transmission works one time. Then the file exists again and I get the same error message.
> I can't change the programm that sends the files. Is there a way to allow the RNTO command to delete the existing
> file before renaming?

FtpServer does not have an option for this (Googling a bit on this
issue, seems like there is disagreement among FTP servers on how this
should be handled). You have some options on how to handle this:
* Simplest, write you own Ftplet that traps the RNTO and cleans out
existing files.
* Subclass our file implementation and replace the move() method with
one that allows existing files

/niklas