I have the following code in my VB.Net app which copies a file from one filepath and moves it to another filepath (see code below).
I want to be able to:
1. Check to see if the file already exists in the destination filepath
2. If the file exists, I want to delete it before copying over the new file
3. Finally, I want to copy the file from the source file path to the destination file path
How do i do this? Thanks in advance mrotor
MY CURRENT CODE USED TO COPY FILE FROM ONE FILEPATH TO ANOTHER
Dim filename As String = "MYFile.txt" '"TestFile.txt"
Dim source As String = Trim("\\TEST_DIRECTORY\ACCOUNT\")
Dim destination As String = System.IO.Path.Combine("\\FINAL_DIRECTORY\PROD\", filename)
System.IO.File.Copy(source, destination, True)