1

How do FTP servers normaly handle rename to a file that aready exist? That is, will the existing to-file be overwritten or will I get an error? Is there some specification about how FTP servers should handle this, or is it OS or implementation dependent?

vsftpd on Linux seems to overwrite, with FileZilla on Vista I get 550 file exists...

RJFalconer
  • 10,369
Kristian
  • 802

2 Answers2

1

After setting up quite a few FTP servers in my time I can say this is server specific. Some FTP servers have a feature where they will not send back a 550 error, but instead rename your upload to file.1, file.2, and so on. This is quite handy to preserve originals in case of accidental overwrite.

The FTP server I prefer to work with is Pure-FTPd. It has this feature with the -r switch:

- '-r': Never overwrite existing files. Uploading a file whoose name
already exists cause an automatic rename. Files are called xyz, xyz.1, xyz.2,
xyz.3, etc.
0

This can be server specific, though generally the old file will just be overwritten. There is one large caveat though: depending on the ownership and permissions set for the file (and the directory it is in) a file that would otherwise be overwritten may result in an error because your user account does not have the correct access rights to delete/modify it.

The behaviour may also vary between FTP client applications. Some will just send the file you tell it to by default, overwriting one no the server if required and the server allows, where some may check the current server directory listing and ask you if you are sure first.