I am trying to copy my file (fileName) into a folder call backup. When the file have been successfully copied into the backup folder, the modifySQLFile() will than read the file
First to answer your problem. You are writing to the wrong file in the modifySQLFile()
method. Should be destFileName
instead of fileName
File.WriteAllLines(fileName, fileTexts);
Secondly, Assuming this file is not huge (<10MB), the better and easier way will be to read the contents of your original file into memory, modify the contents and then write it into backup. There is no need for CopyFile()