title: Convert UNC path to local path in C#
body: <p>Is there a way to do get local path from UNC path? </p>
  
  <p><strong>For eg: \\server7\hello.jpg should give me D:\attachments\hello.jpg</strong></p>
  
  <p>I am trying to save attachments to the UNC path after applying the windows file name and full path length restrictions . Here I am applying the restrictions by taking UNC path length as reference. But local path length is longer than UNC path and i think because of this  I am getting the below exception.</p>
  
  <blockquote>
    <p>System.IO.PathTooLongException occurred   HResult=-2147024690<br>
    Message=The specified path, file name, or both are too long. The fully
    qualified file name must be less than 260 characters, and the
    directory name must be less than 248 characters.   Source=mscorlib<br>
    StackTrace:
           at System.IO.PathHelper.GetFullPathName()
           at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
           at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
           at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share,
    Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs,
    String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean
    checkHost)
           at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions
    options, String msgPath, Boolean bFromProxy)
           at System.IO.FileStream..ctor(String path, FileMode mode)
           at Presensoft.JournalEmailVerification.EmailVerification.DownloadFailedAttachments(EmailMessage
    msg, JournalEmail journalEmail) in
    D:\Source\ProductionReleases\Release_8.0.7.0\Email
    Archiving\Presensoft.JournalEmailVerification\EmailVerification.cs:line
    630   InnerException:</p>
  </blockquote>