PowerShell – Working with File System

PowerShell provides a collection of cmdlets specifically for the purposes of interacting with file systems.

The following table lists the key file system related cmdlets.

Cmdlet Name Description
Get-ChildItem Gets the child items (files and folders)
New-Item Creates file or folder
Copy-Item Copies file or folder
Get-Content Gets the content of a file
Get-Location Gets the current directory
Clear-Item Clears content of a file
Move-Item Moves file or folder
Remove-Item Deletes file or folder
Rename-Item Renames file or folder
Set-Content Sets file content
Add-Content Append content to file
Set-Item Sets file content
Set-Location Sets current directory
Test-Path Check existence of a file or folder