Check if the file exists first, if it does, delete it and then just
copy/move.
if(File.Exists("DestinationFile"){
File.Delete("DestinationFile");
File.Copy(Source,Destination;
}
HTH,
IF you are using the System.IO.File.Copy() function, you can pass in a 3rd
parameter (besides the source and destination strings) which is a boolean
value. If this is set to true it will overwrite the destination file. As
for renaming, you would probably have to check for the existance of the file
with code and then go from there.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.