Skip to Content

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 locations
Filter: Optional. Specifies a filter to qualify the Path parameter
Recurse: Optional. Gets items in specified locations and all child items
Directory: 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