How to copy file from one folder to another in C#?
<p>I have a back up folder and a main folder in my project. I am giving an option to user in main menu to open file from backup folder. For that i have written code:</p>

<pre><code>        string[] paths;
        string fullpath = "";
        paths = Directory.GetFiles(backuppath);
        foreach (string backupfilepath in paths)
        {
            if (path.EndsWith(".txt"))
                fullbackupfilepath = backupfilepath;
        }
</code></pre>

<p>Here backuppath is the path of the backup file.
Now i copy this back up file in main project folder:            </p>

<pre><code>         File.Copy(fullbackupfilepath, mainprojectfilepath);
</code></pre>

<p>But i get the error that Could not find file C:\Users\me\Desktop\csharpproject\bin\debug\BackupProject.txt</p>

<p>Why is it going in bin debug folder when my project is in MyDocuments\Myproject. There is backupfolder inside this Myproject folder.
Please help with a solution.</p>
