how to get file properties?
When reviewing or opening a file, to get its name, the FileInfo class is equipped with the Name property. Here is an sample code:
FileInfo oFileInfo = new FileInfo(strFilename);
if (oFileInfo != null || oFileInfo.Length == 0)
{
MessageBox.Show("My File's Name: \"" + oFileInfo.Name + "\"");
// For calculating the size of files it holds.
MessageBox.Show("myFile total Size: " + oFileInfo.Length.ToString());
}
You can check like this:
if (!oFileInfo.Exists)
{
throw new FileNotFoundException("The file was not found.", FileName);
}
To find out what those date and time values are, you can access the File System Information property using:
DateTime dtCreationTime = oFileInfo.CreationTime;
MessageBox.Show("Date and Time File Created: " + dtCreationTime.ToString());
To know the extension of the file, you can access the value of the FileSystemInfo.Extension property:
MessageBox.Show("myFile Extension: " + oFileInfo.Extension);
Here's a link with information about looking at the attributes.
Besides that, the FileInfo class is what you're probably looking to use.
What other kinds of properties are you looking at?