FileInfo.Delete : FileInfo « System.IO « C# / C Sharp by API






FileInfo.Delete

 
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>");
    }
}

   
  








Related examples in the same category

1.new FileInfo(String fileName)
2.FileInfo.Attributes
3.FileInfo.Create()
4.FileInfo.CreationTime
5.FileInfo.CopyTo(String fileName)
6.FileInfo.Directory
7.FileInfo.FullName
8.FileInfo.LastAccessTime
9.FileInfo.MoveTo(String path)
10.FileInfo.Open
11.FileInfo.OpenRead
12.FileInfo.OpenText
13.FileInfo.OpenWrite()