Zip multiple files then save to a shared location

Last Reply 13 days ago By dharmendr

Posted 14 days ago


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

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

ZipFile zip = new ZipFile();                
zip.AlternateEncodingUsage = ZipOption.AsNecessary;                
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