Use the FileInfo Class to Delete Files with Ease
using System;
using System.IO;
class Class1 {
static void Main(string[] args) {
string [] cla = Environment.GetCommandLineArgs();
if (cla.GetUpperBound(0) == 1)
{
FileInfo fi = new FileInfo(cla[1]);
fi.Delete();
Console.WriteLine("File : " + cla[1]);
Console.WriteLine("Attributes: " + fi.Attributes.ToString());
Console.WriteLine("File Deleted...");
}
else
Console.WriteLine ("Usage: rm <filename>");
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
|