C# FileInfo - FileInfo Class in C# with Examples
Properties |
Description |
Attributes
|
It is used to get or set the attributes for the current file or directory. |
Creation Time
|
It is used to get or set the creation time of the current file or directory. |
Directory
|
It is used to get an instance of the parent directory. |
Directory Name
|
It is used to get a string representing the directory's full path. |
Exists
|
It is used to get a value indicating whether a file exists. |
Full Name
|
It is used to get the full path of the directory or file. |
Is Read Only
|
It is used to get or set a value that determines if the current file is read only. |
Last Access Time
|
It is used to get or set the time from current file or directory was last accessed. |
Length
|
It is used to get the size in bytes of the current file. |
Name
|
It is used to get the name of the file. |
Methods |
Description |
Append Text ()
|
It is used to create a Stream Writer that appends text to the file represented by this instance of the File Info. |
Copy to String () |
It is used to copy an existing file to a new file. |
Create () |
It is used to create a file. |
Create Text () |
It is used to create a Stream Writer that writes a new text file. |
Decrypt () |
It is used to decrypt a file that was encrypted by the current account using the Encrypt method. |
Delete () |
It is used to permanently delete a file. |
Encrypt () |
It is used to encrypt a file so that only the account used to encrypt the file can decrypt it. |
Get Access Control () |
It is used to get a File Security object that encapsulates the access control list (ACL) entries. |
Move To (String) |
It is used to move a specified file to a new specified location. |
Open (File mode) |
It is used to open a file in the specified mode. |
Open Read () |
It is used to create a read-only File Stream.
|
Open Text () |
It is used to create a Stream Reader with UTF8 encoding that reads from an existing text file. |
Open Write () |
It is used to create a write-only File Stream. |
Refresh () |
It is used to refresh the state of the object. |
Replace (String) |
It is used to replace the contents of a specified file with the file described by the current File Info object. |
To String () |
It is used to return the path as a string. |