Search notes:

System.IO.FileInfo (class)

System.IO.FileInfo represents a specific file (which does not necessarily have to exist, see property Exists). The class derives from System.IO.FileSystemInfo.
Compare with System.IO.File which consists of static methods only that are releated to generic file operations in a file system.

Properties and methods

AppendText() Creates a System.IO.StreamWriter with which text can be appended to a file.
CopyTo() Copies a file.
Create() Creates a file and returns a System.IO.FileStream object.
CreateText() Creates a System.IO.StreamWriter with which a new text file can be written to.
Encrypt(), Decrypt() Encrypts/decrypts files for the current account using the cryptographic service provider (CSP) installed on a computer and the encryption keys of the calling process. Only works on NTFS and Windows NT or later.
Delete()
Directory Returns a System.IO.DirectoryInfo object
DirectoryName The string that corresponds to the directory path in which the file is located.
Exists
IsReadOnly
Length
MoveTo()
Name
Open() Opens a file and returns a System.IO.FileStream object.
OpenRead()
OpenText()
OpenWrite()
Replace()
ToString() Returns the file's path as a string.

PowerShell extension Basename

PowerShell comes with a handy extension: BaseName:
PS> ([IO.FileInfo] 'p:/ath/to/a/file.txt').Basename
file

PowerShell

Objects whose type is System.IO.FileInfo might be returned by the PowerShell cmdLets get-childItem and get-item if used in a file sytem provider.

Index