๐
File System
Navigate, read, and manage files and directories.
Listing files and folders
List items in a directory
Show files and folders in the current location.
Get-ChildItemList recursively
Include everything in subfolders too.
Get-ChildItem -Path C:\Projects -RecurseFilter by extension
Only return files matching a pattern.
Get-ChildItem -Path . -Filter *.log -RecurseOnly files (no directories)
Exclude folders from the results.
Get-ChildItem -FileCreating and removing
Create a new folder
Make a directory (parents created as needed).
New-Item -Path ".\reports\2026" -ItemType Directory -ForceCreate an empty file
Make a new empty file.
New-Item -Path ".\notes.txt" -ItemType FileDelete a file or folder
Remove an item; -Recurse for non-empty folders.
Remove-Item -Path ".\temp" -Recurse -ForceCopy, move, rename
Copy a file
Copy a file to another location.
Copy-Item -Path ".\report.docx" -Destination "D:\Backup\"Move a file
Move (or cut) a file to another folder.
Move-Item -Path ".\report.docx" -Destination "D:\Archive\"Rename a file
Change a file or folder name.
Rename-Item -Path ".\old.txt" -NewName "new.txt"Bulk rename with a prefix
Add a date prefix to every .txt file in a folder.
Get-ChildItem -Filter *.txt | Rename-Item -NewName { "2026-07-27_" + $_.Name }Reading and writing content
Read a whole file
Get the full contents of a text file.
Get-Content -Path ".\log.txt" -RawRead the last N lines
Tail the end of a file.
Get-Content -Path ".\log.txt" -Tail 20Write text to a file
Overwrite a file with new content.
Set-Content -Path ".\out.txt" -Value "Hello world"Append text to a file
Add a line without overwriting.
Add-Content -Path ".\log.txt" -Value "New entry"