Copying files network drive getting around 260 character limit C#
<p>Right now i'm attempting to take a screenshot and save it to the local machine, then later copy it to a network drive:</p>

<p>Q:\1234567890123456789012345\123456789012\12345\Screenshots\sc.jpg</p>

<p>^ for an idea about how many characters were talking. I have it setup to create a screenshots folder after that "12345" When the program gets to the point this error occurs:</p>

<p><img src="http://i.stack.imgur.com/yjGb4.png" alt="enter image description here"></p>

<p>How can I avoid this?</p>

<p>Also:</p>

<pre><code>DirectoryInfo scdestinfo = new DirectoryInfo(scdest);
DirectoryInfo scinfo = new DirectoryInfo(sccpath);
CopyAll(scinfo, scdestinfo);
</code></pre>

<p>That's my code for copying the folders/files.</p>

<pre><code>public void CopyAll(DirectoryInfo source, DirectoryInfo target)
    {
        copyall = false;
        try
        {
            //check if the target directory exists
            if (Directory.Exists(target.FullName) == false)
            {
                Directory.CreateDirectory(target.FullName);
            }//end if
            //copy all the files into the new directory
            foreach (FileInfo fi in source.GetFiles())
            {
                fi.CopyTo(Path.Combine(target.ToString(), fi.Name), true);
            }//end foreach
            //copy all the sub directories using recursion
            foreach (DirectoryInfo diSourceDir in source.GetDirectories())
            {
                DirectoryInfo nextTargetDir = target.CreateSubdirectory(diSourceDir.Name);
                CopyAll(diSourceDir, nextTargetDir);
            }//end foreach
            //success here
            copyall = true;    
        }//end try
        catch (IOException ie)
        {
            MessageBox.Show(ie.Message);
            //handle it here
            copyall = false;
        }//end catch
    }//end CopyAll
</code></pre>

<p>And the copyall function.</p>
