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.
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
Post a Comment