title: Convert Network share path to a physical folder path
body: <p>I have a console application that is using a FileSystemWatcher to watch a folder, which fires off an event when there is a file/folder deleted.</p>
  
  <p>My Simplified Code:</p>
  
  <pre><code>using System;
  using System.Configuration;
  using System.Diagnostics;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Text.RegularExpressions;
  using System.Threading;
  
  namespace FileWatcherConsole
  {
      class Program 
      {
          static void Main(string[] args)
          {
              Program program = new Program();
              FileSystemWatcher watcher = new FileSystemWatcher
              {
                  Path = "\\Server1",
                  IncludeSubdirectories = true,
                  EnableRaisingEvents = true,
                  NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName,
                  Filter = "*.*"
              };
              watcher.Deleted += new FileSystemEventHandler(program.OnDeleted);
              new AutoResetEvent(false).WaitOne();
          }
  
          private void OnDeleted(object sender, FileSystemEventArgs e)
          {
              Console.WriteLine(e.FullPath);
          }
      }
  }
  </code></pre>
  
  <p>The application works as expected, except for when watching a network shared folder where the output is</p>
  
  <pre><code>\\Server1\SharedFolder
  </code></pre>
  
  <p>However I would instead like the physical path of the folder:</p>
  
  <pre><code>C:\Users\myUser\Desktop\SharedFolder
  </code></pre>
  
  <p>So is there a way to programmatically convert the network path to a physical path ? </p>
  
  <p>I know one solution is to use the physical path when instantiating FileSystemWatcher, however this is not ideal as physical location of the network share folder can change.</p>
  
  <p>P.S. If you deem necessary the reasoning behind this, I need the physical path as I am comparing the the event path [e.FullPath] with system auditing events</p>