user3894737
user3894737

Reputation: 31

overwrite file in ftp rename command

I have a ftp application. This application uses ftp rename command. If a file already exists in a directory which the file is renamed to, the error message 'the file not avaliable' caught. What can I do in c# to overwrite a file? In IIS there is a setting for this. When I do this, there is no problem.But,can I do this from c#?

Upvotes: 0

Views: 1585

Answers (1)

Alex K.
Alex K.

Reputation: 175936

What happens when there is a name collision depends on the server, if you cannot configure a known behaviour on each server you connect to you need to deal with it manually.

Either attempt a rename, catch the exception, delete the file then rename again or check for the files existence first (by requesting it size for example) and deleting it if found.

Upvotes: 2

Related Questions