about_IOInfoExtensions.PowerShell_GetFile.help.txt
TOPIC
about_IOInfoExtensions.PowerShell_GetFile SHORT DESCRIPTION Returns a <FileInfo> object for the child file with the specified name. SYNTAX GetFile(string name, [bool resolve = False], [bool ignoreCase = True]) PARAMETERS name <System.String> The name of the child file to return. Required: True Default Value: Accepts Wildcard Characters: False resolve <System.Boolean> If set to true, it will throw an error if a matching child file is not found. Required: False Default Value: False Accepts Wildcard Characters: False ignoreCase <System.Boolean> If set to false, it will throw an error if a matching child directory is found but with a different case. Required: False Default Value: True Accepts Wildcard Characters: False OUTPUTS System.IO.FileInfo EXCEPTIONS System.ArgumentException If the given name is null, empty, or just whitespace. System.Exception If the given name matched multiple child items. This will happen if a wildcard was passed as part of the name. System.IO.FileNotFoundException If the given name resolves to a child directory, resolve = true and the child file does not exist, or if ignoreCase = false and the casing doesn't match. EXAMPLES --------------------- Example 1 --------------------- PS> $directory = New-Object System.IO.DirectoryInfo 'C:\Demo' PS> $directory.GetFileSystemInfos().FullName C:\Demo\ChildDir1 C:\Demo\ChildDir2 C:\Demo\ChildFile1.txt C:\Demo\ChildFile2.txt PS> $child = $directory.GetFile('childfile1.txt') PS> $child.FullName C:\Demo\childfile1.txt PS> $child.GetType().FullName System.IO.FileInfo PS> $child.Exists True KEYWORDS IOInfoExtensions, IOInfoExtensions.PowerShell, System.IO.DirectoryInfo, DirectoryInfo, GetFile SEE ALSO about_IOInfoExtensions.PowerShell about_IOInfoExtensions.PowerShell_GetDirectory about_IOInfoExtensions.PowerShell_GetFile about_IOInfoExtensions.PowerShell_DeleteContent about_IOInfoExtensions.PowerShell_CopyContentTo about_IOInfoExtensions.PowerShell_MoveFrom about_IOInfoExtensions.PowerShell_CopyFrom about_IOInfoExtensions.PowerShell_TryDelete |