Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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...

share|improve this question
I think it's server specific. – alex Sep 10 '09 at 9:35
You probably shouldn't cross-post the same question to both SF and SU like that (…) – David Spillett Sep 10 '09 at 10:29
(In the old usenet days, a crosspost would be a single post, showing in multiple groups. For a crosspost, people would at least see existing answers, unless some followup-to was set. Still, crossposting was frowned upon, so let alone how people felt/feel about multiposting, like this very question...) – Arjan Sep 10 '09 at 10:41
Agreed, but I'm not sure where the question belongs. Was trying to figure out where it's best to post it, but posted on both to see where I got the best answers... – Kristian Sep 10 '09 at 10:51
I think cross-posting, under the correct circumstances, isn't frowned upon by Jeff. – Phoshi Nov 8 '09 at 11:38
up vote 1 down vote accepted

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.
share|improve this answer

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.

share|improve this answer
The question was not about sending a file with a name that already exists, but about renaming a remote file. – Arjan Sep 10 '09 at 11:45
Ah, sorry for misreading. A file rename operation will still be dependent on both the access rights, the server implementation and the client's implementation. As far as I know no "standard" behaviour is defined in the relevant RFCs. – David Spillett Sep 10 '09 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .