---
title: "Get-ChildItem: List Files & Folders with PowerShell"
description: "Discover Get-ChildItem, a PowerShell cmdlet for listing files and folders on a file system via the console."
canonical: "https://adamtheautomator.com/get-childitem/"
---

# Get-ChildItem: List Files & Folders with PowerShell

> Discover Get-ChildItem, a PowerShell cmdlet for listing files and folders on a file system via the console.

Source: https://adamtheautomator.com/get-childitem/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Get-ChildItem: List Files & Folders with PowerShell](https://adamtheautomator.com/wp-content/uploads/2019/06/5d238ae5c824b514689ea54c.jpg)

# Get-ChildItem: List Files & Folders with PowerShell

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)18 June 20193 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)

Table of Contents

*   [Get-ChildItem Traverses a Tree](#get-childitem-traverses-a-tree)
*   [PowerShell Providers](#powershell-providers)
*   [Filtering](#filtering)
*   [Summary](#summary)

Remember the good ol’ days of the DOS `dir` command? How about the Linux `ls` command? If so, the Get-childItem is essentially that but taken up a notch.

In fact, we even have `dir` and `ls` in PowerShell in the form of an alias. The Get-Childitem PowerShell cmdlet can not only list files and folders on a file system via the PowerShell console or [PowerShell](https://adamtheautomator.com/tag/powershell/) script but can also enumerate registry keys and values, certificates in various certificates stores and even Active Directory, to name a few.

> _If you’re a beginner/intermediate PowerShell scripter, be sure to check out my FREE mini-course on Building a PowerShell Tool! 9,000+ words of deep explanation and insights on how to build a PowerShell tool._

To understand Get-Childitem, first, think of it regarding `dir` and `ls` but instead of just files it treats many objects as a child item and enumerates them. You can use the alias or the full command name to use it.

Since this command has been available since PowerShell v1, you can be sure that it will work with your [PowerShell version](https://adamtheautomator.com/powershell-version/).

## Get-ChildItem Traverses a Tree

A file system is a hierarchy. It has a folder structure with files inside of folders and those folders inside of other folders. A file system is like a tree. That tree has a trunk (`C:\` for example) and “branches” coming off of it (folders). In fact, we even have a `tree` command.

```powershell
PS> tree
Folder PATH listing for volume HD
Volume serial number is 0000007B 22DC:666C
C:.
 \modules
   \AdsiPS
     \1.0.0.2
       \Public
       \AWSPowerShell
<SNIP>
```

You can point this command at either local paths on the local computer, use a PowerShell remote scriptblock and use `Get-ChildItem` inside of that or just point it at a UNC path. All work the same. Maybe I just want to list all of the files in the current directory.

```powershell
PS> dir -Path .
PS> Invoke-Command -ComputerName SERVER1 -Scriptblock { dir -Path . }
```

## PowerShell Providers

Microsoft realized that navigating this “tree” like structure of a file system could be applied to other systems as well. A file system “tree” has folders and files but a registry has keys and values while the certificate system in Windows has stores and certificates inside of those stores. Each of these specific areas can all be represented as a tree thus the PowerShell provider was born. Why all this talk about PowerShell providers? Because the `Get-ChilldItem` cmdlet is part of the `*-Item` cmdlets that interact with PowerShell drives that each provider exposes.

The `Get-ChildItem` cmdlet can output any number of objects on a PowerShell drive and allows you to process each item via the pipeline or perhaps in a PowerShell [foreach](https://adamtheautomator.com/powershell-foreach/ "foreach") loop. It understands the concept of a PowerShell drive which allows you to specify a `Path` of a file system folder, a registry key or a certificate store all in one.

You can see below that this command can enumerate the _C:\\_ folder, the HKEY Current User hive as well as the PowerShell certificate store.

```powershell
PS> Get-ChildItem -Path C:\


    Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/2/2017   7:01 AM                AppData
d-----        4/25/2017   4:36 PM                CheckPoint

PS> Get-ChildItem -Path HKCU:\


    Hive: HKEY_CURRENT_USER


Name                           Property
----                           --------
BCD00000000

PS> dir -Path Cert:\


Location   : CurrentUser
StoreNames : {TrustedPublisher, ClientAuthIssuer, Root, UserDS...}
```

## Filtering

The `Get-ChildItem` PowerShell command cannot only pull _all_ objects on a drive but can filter the information as well through a couple of different parameters: `Filter`, `Include` and `Exclude`. You’ll always want to use the ubiquitous PowerShell `Filter` parameter when possible. This parameter directly passes the filter syntax to the individual provider. Although much quicker, this syntax solely depends on the provider being queried.

For example, a `Filter` syntax of `Name -eq 'foo'` may be completely fine when querying files but won’t work at all when querying the registry because the registry provider doesn’t even have a filter!

```powershell
PS> dir HKLM:\ -Filter "Name -eq 'foo'"
ls : Cannot call method. The provider does not support the use of filters.
At line:1 char:1 + ls HKLM:\ -Filter "Name -eq 'foo'" +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          :
NotImplemented: (:) [Get-ChildItem], PSNotSupportedException     +
FullyQualifiedErrorId :
NotSupported,Microsoft.PowerShell.Commands.GetChildItemCommand
```

When all else fails though, you always have the `Include` and `Exclude` parameters as well.

This command in PowerShell also has a few filesystem-specific parameters like `Force` which will output hidden files and folders, `File` and `Directory` which only finds files or folders. Take a look at the full breakdown of `Get-ChildItem` via `Get-Help` or in the [Microsoft docs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-5.1).

Another cool thing about `Get-ChildItem` is it’s ability to resolve paths when using the wildcard character. In PowerShell, wildcard character typically represents anything. For example, if you’d like to see all files with the .txt file extension, just specify the path to the folder and `*.txt`.

```powershell
PS> Get-ChildItem -Path 'C:\*.txt'
```

We could also filter on file attributes as well. Perhaps we just want to find only the read-only files in a folder.

```powershell
PS> Get-ChildItem -Path C:\ -Attributes R -File
```

## Summary

This PowerShell command is one of those cmdlets that you’ll use repeatedly. Most of the time, you’ll probably be using the FileSystem provider, but it’s important to remember that this cmdlet is capable of much more. Use it to query files, folders, registry keys, registry values, certificates, Active Directory users, computers or even environment variables, functions and more!

When in doubt, run the `Get-PSDrive` command to see a list of all of the loaded PowerShell drives that `Get-ChildItem` can query for you.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fget-childitem%2F&text=Get-ChildItem%3A%20List%20Files%20%26%20Folders%20with%20PowerShell)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fget-childitem%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fget-childitem%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2025/10/image_2025-10-24_095322075.png)

### [Migrating from PowerShell 6 to 7.5: Breaking Changes/New Features](/migrating-powershell-6-to-7-5/)

Migrate from PowerShell Core 6 to 7.5: breaking changes, features, and testing tips.

![](https://adamtheautomator.com/wp-content/uploads/2025/06/featured-image-6.png)

### [How to Add Timeouts to Pester Tests with PowerShell Runspaces](/pester-test-timeout-runspaces/)

Prevent Pester tests from hanging indefinitely using PowerShell runspaces. Learn to handle variable scoping, module loading, TestDrive access, and stream capture challenges with timeout protection.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
