How to get file creation date and other useful information using VB.NET in .NET 2.0
Author: Aadil
In this article I’ll show you how to get the information relating the creation date time of files in a folder and other related information.
You can get various details about the files present on the file system by using the new capabilities added in the FileInfo class. First of all the Arrtibutes property of this class is there so you can use that to find the various attributes of the specific file. There is a property named CreateTime that represents the creation time of the file. This is a readable and writable property and it is a DateTime object. So you can get as well set the Creation time for a file using this property.
You can encrypt a file using the built in capabilities of the windows file systems, like the NTFS file system using the Encrypt method and there is a method Decrypt that can be use to reverse the same process. Similarly you can get the file’s last access time and the last write time using these two properties LastAccessTime and LastWriteTime, respectively.
The MoveTo() method takes a single argument and simulates a move operation and moves the file to the new destination path supplied in the argument. The file will be disappeared from the source path.
Similarly you can use the AppendText method to get an object of StreamWriter that is set to do appending on the file. It means you can just use this operation and use the StreamWriter to appends any data to the file. A sample function using this object is as follows.