Zip multiple files then save to a shared location

Last Reply 13 days ago By dharmendr

Posted 14 days ago

Hi

My process is1.reading tables from database2.then create xlsx files using datatable3.Read other static files4.then zip all files with predefined name5.then save to a shared folderi refered this link

https://www.aspforums.net/Threads/588158/Export-each-GridView-row-in-separate-Excel-and-create-Zip-File-using-C-and-VBNet-in-ASPNet

but when i run code im getting files beside zipfolderalso inside files is inside directory Files 

ZipFile zip = new ZipFile();                
zip.AlternateEncodingUsage = ZipOption.AsNecessary;                
zip.AddDirectoryByName("Files");     
foreach (string filepath in folderPaths) 
{                    
    zip.AddFile(filepath, "Files");                
}
string zipName = String.Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"));                
zip.Save(Path.Combine(folderPath, zipName));            

I just want zipfile iside it all files .When i removedzip.AddDirectoryByName("Files");

im not getting desired result . i want Zip_2020-Jun-23-164623 zipfolder inside it all files zippedHow to do this

Thanks in Advance

You are viewing reply posted by: dharmendr 13 days ago.
Posted 13 days ago