Tuesday, February 7, 2012

Display all information of a text file


Get all information from a file

This program will print some of the information regarding file. 
  • Here fi is object of FileInfo class
  • We are calling a constructor with a string filepath.
    protected void Page_Load(object sender, EventArgs e)
    {

        System.IO.FileInfo fi = new FileInfo("D:\\jello.txt");
        Response.Write("Filename:-"+fi.FullName);
        Response.Write("Creation Time:-"+fi.CreationTime);
        Response.Write("File type:-" + fi.GetType);
        Response.Write("Last write time:-" + fi.LastWriteTime);
        Response.Write("File Size:-"+fi.Length);
  
    }


No comments:

Post a Comment