Getting Detail about a File

Introduction

This blog introduce to display details about a file, such as name, extension, creation time, last access time. Using FileInfo class of System.IO Namespace you can get the details. see the bellow code fore more details.

FileInfo FI = new FileInfo("Path");

Console.WriteLine("File Name :" + FI.Name);

Console.WriteLine("==========-==========-==========-==========-==========-==========");

Console.WriteLine("Creation Time :" + FI.CreationTime);

Console.WriteLine("Directory of the File :" + FI.Directory);

Console.WriteLine("Directory Name of the File :" + FI.DirectoryName);

Console.WriteLine("Extension of the File :" + FI.Extension);

Console.WriteLine("Full Name of the File :" + FI.FullName);

Console.WriteLine(" Is Read Only :" + FI.IsReadOnly);

Console.WriteLine("last Access time :" + FI.LastAccessTime);

Console.WriteLine("Last Write Time :" + FI.LastWriteTime);

 

Summery

Above example we learned how will display file properties.

Ebook Download
View all
Learn
View all