Forrest logo
back to the Get-ChildItem tool

get-childitem:tldr:a4f25

get-childitem: List all non-hidden items in the current directory.
$ Get-ChildItem
try on your machine

The command "Get-ChildItem" is a cmdlet in PowerShell that retrieves the child items (such as files and folders) within a specified directory. It is similar to the "dir" command in Command Prompt.

When you run the "Get-ChildItem" command, it returns a list of the items contained within the specified directory. By default, it displays the name, type, and last write time of each item.

Here are some common uses and options of the "Get-ChildItem" command:

  • "Get-ChildItem" returns the child items in the current directory.
  • You can specify the directory path as an argument to retrieve the child items in a specific directory: "Get-ChildItem C:\Path\To\Directory".
  • The "-Recurse" parameter can be used to recursively retrieve all child items in subdirectories as well.
  • The "-Name" parameter can be used to display only the names of the child items.
  • The "-File" and "-Directory" parameters can be used to filter and display only files or only directories, respectively.
  • The "-Filter" parameter allows you to specify a pattern to filter the child items based on their names.
  • Other parameters like "-Attributes", "-Force", "-Exclude", "-Include" can be used for additional filtering and customization.

Overall, the "Get-ChildItem" command is useful for listing and examining the contents of directories in PowerShell.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the Get-ChildItem tool