C# Create zip, add file but can't open -


i'm not c# developer knowledge limited. however, i'm trying write program in c# exports windows security log date , export evtx file.

but have add evtx file zip file. code below creates zip file (i can see it) , adds evtx file zip (i think because in windows explore size changes 0kb more).

        #region "compress evtx file zip file: "         // first create new zip archive in "achives" folder.         string zipfilename = "zip-" + getdatetimestamp(1) + ".zip";         string zipfilepath = system.io.path.combine(zipevtxdirectorypath, zipfilename);         ziparchive zipfile = zipfile.open(zipfilepath, ziparchivemode.create);          // add evtx file created in program directory zip archive.         console.writeline(evtxfilepath);         console.writeline(evtxfilename);         zipfile.createentryfromfile(evtxfilepath, evtxfilename);          //evtxfilepath = "d:\test\vs\filesandfolders\testdirectory\archives\security-log-archive-11-01-2015-04-18-58.evtx"         //evtxfilename = "security-log-archive-11-01-2015-04-18-58.evtx"         //zipfilepath = "d:\test\vs\filesandfolders\testdirectory\archives\zip-11-01-2015-04-18-58"          #endregion 

but when go try open zip file using windows explorer, gives me error.

enter image description here

perhaps, code i'm using incomplete? or missed something?

you have written piece of code opens file , writes. once process of creating file , writing in it, should tell pc close file.

im not sure of commands in instance, try

zipfile.close; 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -