|
/*
* Patrick Bounaix
* www.L0g1c4L.com
*
* See AssemblyInfo.cs
* for License Information
* */
#region using
using System;
using System.IO;
using System.Windows.Forms;
#endregion
namespace L0g1c4L.ApplicationCleaner
{
/// <summary>
/// Summary description for FilesRemover.
/// </summary>
class FilesRemover
{
#region Private...
#region Methods
#region ClearAll
private static void ClearAll(string path)
{
DirectoryInfo di = new DirectoryInfo(path);
FileInfo[] fi = di.GetFiles();
if (fi.Length > 0)
{
// directory pass //
for (int i=0; i<fi.Length; i++)
{
try
{
fi[i].Delete();
}
catch
{
}
}
}
DirectoryInfo[] d = di.GetDirectories();
if (d.Length > 0)
{
for (int j = 0; j<d.Length; j++)
{
try
{
d[j].Delete(true);
}
catch
{
}
}
}
}
#endregion
#region Main Method
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
ClearAll(Application.StartupPath);
}
#endregion
#endregion
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here