0

I'm developing a console application with dot net that reads 7zip compressed csv files, and load csv file into a DB. It works well with tab separator, with special characters, but if the file has the "comma" separator, there is an error message "Bad signature".

The code is below:

        string DirPath = "myPath/myFolder";
        DirectoryInfo dir = new DirectoryInfo(DirPath);
        FileInfo[] FileList = dir.GetFiles("*.7z", SearchOption.AllDirectories);

        foreach (var fileZip in FileList)
        {
            try
            {
                using (ZipFile zip = ZipFile.Read(fileZip.FullName))
                {
                    var a = zip.Entries.Where(p => p.FileName.EndsWith(".txt") || p.FileName.EndsWith(".csv")).ToList();

In the portion of code above, the error "bad signature" is thrown on the using statement, and only if the compressed file has a comma separator. Do you have any suggestion? Have you never ever face anything like that? Thanks in advance for your support! Cheers!

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Fenuska
  • 118
  • 1
  • 9

0 Answers0