System.IO.FileInfo
represents a specific file (which does not necessarily have to exist, see property Exists
). The class derives from System.IO.FileSystemInfo
. System.IO.File
which consists of static methods only that are releated to generic file operations in a file system. 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. |
BaseName
: PS> ([IO.FileInfo] 'p:/ath/to/a/file.txt').Basename file
System.IO.FileInfo
might be returned by the PowerShell cmdLets get-childItem
and get-item
if used in a file sytem provider.