locked
How could i check if the extract file from .gz is already in directory exists ? RRS feed

  • Question

  • This code should decomprees the .gz extention file but i want to check if the file is already extracted or already exists 

    How can i check ? 

     
      public static void Decompress(FileInfo fileToDecompress)
            {
                using (FileStream originalFileStream = fileToDecompress.OpenRead())
                {
                    string currentFileName = fileToDecompress.FullName;
                    string newFileName = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);
    
                    using (FileStream decompressedFileStream = File.Create(newFileName))
                    {
                        using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
                        {
                            decompressionStream.CopyTo(decompressedFileStream);
    
                        }
                    }
                }
            }
    

    • Moved by Dave PatrickMVP Wednesday, December 18, 2019 1:22 PM looking for forum
    Wednesday, December 18, 2019 9:09 AM

Answers

All replies

  • I'd try asking for help over here.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral

    https://forums.asp.net/37.aspx/1?C+

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Wednesday, December 18, 2019 1:22 PM
  • how could i find the right fourm ? like C# forum ?!
    Thursday, December 19, 2019 10:46 AM
  • how could i find the right fourm ? like C# forum ?!

    You can find forums for example by searching in Google: only search for "c# forum" or more precisly "msdn c# forum" and you will find the MSDN C# Forum and some others too.

    Regards, Guido

    Edit: or if you are already in the MSDN main page, then just search for the forum "C#" and/or select the Visual C# Forum directly.
    Thursday, December 19, 2019 12:14 PM