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: 
Can you take a look at the [Path.Combine](http://msdn.microsoft.com/en-us/library/fyy7a5kt.aspx) method on MSDN? This will help make sure all your entire path doesn't have extra \'s where they shouldn't be.

i.e. `Path.Combine(sourceDir, toBeCopied[i])`

If you are still getting an error, let me know what the value if the above.
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);

```