Question: I've googled about this all over the Internet and still haven't found a solution. As an ultimate try, I hope someone can give me an exact answer.

I get that error when I try to copy a file from a directory to another in an File Explorer I'm trying to do on my own. It has a treeview control to browse for directories and a listview control to display the contents of the directory. This is how the code would look like, partially:

```
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
    {
        sourceDir = treeView1.SelectedNode.FullPath;
        for (int i = 0; i < listView1.SelectedItems.Count; ++i)
        {
            ListViewItem l = listView1.SelectedItems[i];
            toBeCopied[i] = l.Text; // string[] toBeCopied, the place where I save the file names I want to save
        }
    }

private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
    {
        targetDir = treeView1.SelectedNode.FullPath;
        try
        {
            for (int i = 0; i < toBeCopied.Length; ++i)
            {
                File.Copy(sourceDir + "\\" + toBeCopied[i], targetDir + "\\" + toBeCopied[i], true);
                refreshToolStripMenuItem_Click(sender, e);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message + Environment.NewLine + ex.TargetSite);
        }
    }

```

The place where I got the error is at `File.Copy(sourceDir + "\\" + toBeCopied[i] ...`.

I've read that it could be something that has to do with the mapping of devices, but I don't really know what that is.

Answer: 
Does the target path up to the file name exist? `File.Copy()` will not create any missing intermediate path, you would need to do this yourself. Use the debugger to see both the source and target paths you are creating and make sure the source exists and the target exists at least up to the parent of the target file.
Assuming both `sourceDir` and `targetDir` exist (which you can *and should* check), you might be doubling up a trailing `\`. When building paths, you should use [Path.Combine](http://msdn.microsoft.com/en-us/library/fyy7a5kt.aspx).

```
File.Copy(Path.Combine(sourceDir, toBeCopied[i]), Path.Combine(targetDir, toBeCopied[i]), true);

```