c# - Trying Zip different folders in in a specified directory using ZipFile -


i found code below on stack overflow tried didn't know how use fully.

basically want able zip files separately using foreach loop won't have list of files change each time.

so how can list of folders/directories inside root directory array?

public static void createzipfile(string filename, ienumerable<string> files) {     var zip = zipfile.open(filename, ziparchivemode.create);     foreach (var file in files)     {         zip.createentryfromfile(file, path.getfilename(file), compressionlevel.optimal);     }      zip.dispose(); } 

normally use dotnetzip
, code:

using (var file = new zipfile(zipname)) {     file.addfiles(filenames, directorypathinarchive);     file.save(); } 

where zipname name of zip archive want create , filenames names of files want put in it.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -