Clean Up - Old files and references sizes in C# to SSIS

You can use this code to do the cleaning up by date or name file lengthYou can use this code to do the cleaning up by date or name file lenght



#region Namespaces
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
#endregion


        public void Main()
        {

            string directoryPath = @"\\Tonyx\Onyx\Exports\Lists\Products\";


            string[] oldFiles = System.IO.Directory.GetFiles(directoryPath, "unmatched_hosted_product_codes*.xls");


            foreach (string currFile in oldFiles)
            {

                FileInfo currFileInfo = new FileInfo(currFile);


               // if (currFileInfo.CreationTime < DateTime.Now.AddDays(-1))
                if (currFile.Length > 73)
                {

                    currFileInfo.Delete();

                }


            }


            // TODO: Add your code here

            Dts.TaskResult = (int)ScriptResults.Success;

        }
        #region ScriptResults declaration
        /// <summary>
        /// This enum provides a convenient shorthand within the scope of this class for setting the
        /// result of the script.
        ///
        /// This code was generated automatically.
        /// </summary>
        enum ScriptResults
        {
            Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
            Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
        };
        #endregion

 }
}