Good day!
I use to create an archive library SharpZipLib.
I can’t transfer a list of files and create an archive.
At the moment it simply deletes the files.
Here is my code:
using System; using System.Data; using Microsoft.SqlServer.Dts.Runtime; using System.Windows.Forms; using System.IO.Compression; using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Core; public void Main() { var myDate = DateTime.Now; var startOfMonth = new DateTime(myDate.Year, myDate.Month, 1); string rootFolderPath = @"E:\Download"; string filesToDelete = @"*T_D_FD_DRYUA*"; string[] fileList = System.IO.Directory.GetFiles(rootFolderPath, filesToDelete); if (DateTime.Now!= startOfMonth) { foreach (string file in fileList) { //System.Diagnostics.Debug.WriteLine(file + "will be deleted"); //System.IO.File.Delete(file); Dts.TaskResult = (int)ScriptResults.Success; } } } How to use this library to correctly create an archive of necessary files? Thank!
Ionic.zip, - GooliveR