Quantcast
Channel: sharpcompress Discussions Rss Feed
Viewing all articles
Browse latest Browse all 239

New Post: Left date (creation, read, edit) unchanged after file is added to archive

$
0
0
I successfully create my zip archive but, I don't want that editing date of file added in this zip archive is automatically altered. In the worst case I would set editing date to a given date.
How can avoid this behaviour? This is my code:
        private String CreaPacchettoZip(String idProcesso, String pdfBasePath, String primoPdfPacchetto, String ultimoPdfPacchetto)
        {
            List<String> listaPdfDiProcesso = FileHelper.EstraiListaPdfDaDirecotry(pdfBasePath, primoPdfPacchetto, ultimoPdfPacchetto);
            String zipFile = Path.Combine(pdfBasePath, idProcesso + ".zip");

            using (var archive = ZipArchive.Create())
            {
                
                foreach (String file in listaPdfDiProcesso)
                {
                    archive.AddEntry(file, new FileInfo(pdfBasePath, file));
                }

               using (Stream newStream = File.Create(zipFile))
                {
                    archive.SaveTo(newStream, SharpCompress.Common.CompressionType.None);
                }
            }

            return zipFile;
        }

Viewing all articles
Browse latest Browse all 239

Trending Articles