Get-ChildItem
- Description
- Gets the items and child items in one or more specified locations.
- Syntax
Get-ChildItem [[-Path] <String[]>] [[-Filter] <String>] [-Recurse] [-Directory] [-File]
- Example
Get-ChildItem -Path 'C:\Windows' -Recurse -File -Filter '*.log'
- Parameters
- Path: Optional. Specifies a path to one or more locationsFilter: Optional. Specifies a filter to qualify the Path parameterRecurse: Optional. Gets items in specified locations and all child itemsDirectory: Optional. Gets directories (folders)File: Optional. Gets files
- Return type
- System.IO.FileInfo or System.IO.DirectoryInfo
- Aliases
- gci, ls, dir
- Supported Windows versions
- Windows PowerShell 2.0 and laterWindows 7Windows 8Windows 10Windows 11Windows Server 2008 R2 and later