title: c# file compress with .gzip
body: <p>I am trying to compress files with GZIP and my application monitors a folder for new files. When a new file comes in, it should be compressed and then application should continue doing this every time a new file comes in folder.</p>
  
  <pre><code>private void Compress(string filePath)
      {
  
        using (FileStream inputStream = new FileStream(filePath,FileMode.OpenOrCreate,FileAccess.ReadWrite))
          {
              using (FileStream outputStream = new FileStream(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"C:\\Users\\maki\\Desktop\\Input"), FileMode.OpenOrCreate, FileAccess.ReadWrite))//'System.UnauthorizedAccessException' 
              {
                  using (GZipStream gzip = new GZipStream(outputStream, CompressionMode.Compress))
                  {
                      inputStream.CopyTo(gzip);
                  }
              }
          }
  
  
      }
  </code></pre>
  
  <p>when I execute the application, I get this exception: </p>
  
  <pre><code>An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
  </code></pre>
  
  <p>Additional information: </p>
  
  <pre><code>Access to the path 'C:\Users\maki\Desktop\Input' is denied.
  </code></pre>
  
  <p>I've searched a lot in internet but couldn't find a proper answer.</p>
  
  <p>Can anyone help me with issue?</p>