Hi Team
I have used the sharziplib.dll to unzip aroung 1400 folders which contains text files.
However after processing around 236 folders I land up with an error called "End of stream".
My Code:
static void unzip()
{
try
{
var files = new List<string>(Directory.GetFiles(path, "*.zip*", SearchOption.AllDirectories));
foreach (var item in files)
{
var zipFileName = item;
var targetDir = Path.Combine(path,"unpack");
FastZip fastZip = new FastZip();
string fileFilter = null;
fastZip.ExtractZip(item, targetDir, fileFilter);
}
Dictionary<string, int> Messagetype = new Dictionary<string, int>();
var txtfiles = new List<string>(Directory.GetFiles(Path.Combine(path,"unpack"), "*.*", SearchOption.AllDirectories));
foreach (var eachtxtfiles in txtfiles)
{
using (var reader = new StreamReader(eachtxtfiles))
{
string line;
int counter = 0;
line = reader.ReadLine();
while (line != null)
{
if (!string.IsNullOrEmpty(line))
{
string[] parts = line.Split(new[] { "|" }, StringSplitOptions.None);
if (!Messagetype.ContainsKey(parts[1]))
Messagetype[parts[1]] = 0;
Messagetype[parts[1]]++;
}
line = reader.ReadLine();
}
}
}
foreach (var ms in Messagetype.Keys)
{
Console.WriteLine(ms + "-" + Messagetype[ms]);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadKey();
}
What I have tried:
I made sure the folders are not corrupt ..
Contains only zip folders..
Same functions in my local system I just have 5 zipped folders. However in server we have about 1400+ zipped folders which is about 850GB data. In server I am running it as console application