In my project I'm uploading a 7Zip
, Zip
, Tar
, Winzip
, WinRAR
, and etc file.
Now I want to check if particular file is present in uploaded archive using C#.
Can anyone please help me?
In my project I'm uploading a 7Zip
, Zip
, Tar
, Winzip
, WinRAR
, and etc file.
Now I want to check if particular file is present in uploaded archive using C#.
Can anyone please help me?
using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{
Boolean isFolderExist = false;
foreach (ZipArchiveEntry entry in archive.Entries) {
if (entry.FullName.Contains("PDFsDir/")) {
isFolderExist = true;
}
}
if (isFolderExist) {
Console.WriteLine("the folder which name is pictures exists in zip file");
if(entry.FileName.Contains( "PDFsDir" )==true) {
Console.WriteLine("File Exist");
}
} else {
Console.WriteLine("the folder doesn't exist ");
}
}