PowerShell’s file cmdlets let you inspect, create, read, write, copy, move, and delete files and folders. For routine work, use Get-ChildItem to find items, New-Item to create them, Get-Content and Set-Content or Add-Content to handle text, and Copy-Item, Move-Item, or Remove-Item to manage them. The examples below use Windows paths; change them to match your system.
How PowerShell file cmdlets work
PowerShell cmdlets operate through providers. The FileSystem provider exposes files and directories, but many of the same item, path, and content cmdlet families also work with other providers. To work with files, pass a filesystem path such as C:Datareport.csv or a relative path such as ./report.csv.
Cmdlets return objects, not just formatted text. That makes it possible to filter results by properties such as a file’s size, then pass the selected items to another command. Microsoft’s overview of provider command families is in about_Core_Commands; filesystem-specific behavior is described in about_FileSystem_Provider.
List files and folders
Get-ChildItem lists items in a location. Without recursion, it lists direct children; use -Recurse to include items in subfolders. Add -File when you only want files, or -Directory when you only want folders.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Get-ChildItem -Path C:Data
Get-ChildItem -Path C:Data -Recurse
Get-ChildItem -Path C:Data -Recurse -File
To include hidden and system items, add -Force. Use -Depth to limit how many directory levels recursion traverses, and a filter to narrow matching names:
Get-ChildItem -Path C:Data -Recurse -Depth 2 -Filter *.csv -Force
For a property-based condition, pipe the results to Where-Object. This example selects files larger than 1 MB:
Get-ChildItem C:Data -Recurse -File | Where-Object Length -gt 1MB
Get-Location displays the current location, and Set-Location changes it. Relative paths are resolved from that location. Use Test-Path to check whether a target path exists before acting on it.
Rank #2
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Create files and folders
Use New-Item with -ItemType Directory for a folder or -ItemType File for an empty file:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteNew-Item -Path C:TempReports -ItemType Directory
New-Item -Path C:TempReportsrun.txt -ItemType File
The meaning of -Force depends on the target: Microsoft’s examples note that it returns an existing folder rather than replacing it, while using it for an existing file overwrites that file. Do not add -Force unless that behavior is intended.
Read and write file contents
Get-Content reads text as lines by default. Use -Raw to return the file as one string, -Tail to read the last specified number of lines, and -TotalCount to limit the read to the first specified number of lines.
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Get-Content -Path .log.txt
Get-Content -Path .log.txt -Raw
Get-Content -Path .log.txt -Tail 50
Get-Content -Path .log.txt -TotalCount 20
For text files where encoding matters, specify -Encoding. For byte-oriented input, use -AsByteStream rather than treating the data as text.
Set-Content replaces a file’s existing contents; Add-Content appends to them. Both can create a file if the target does not exist.
Set-Content -Path .status.txt -Value 'Complete'
Add-Content -Path .status.txt -Value 'Next step'
Choose Set-Content when the new value should replace what is there, and Add-Content when the existing contents must remain and the new value should be added after them. Microsoft’s examples and parameters for these operations are in the Get-Content and Set-Content references.
Rank #4
- Ultra Slim and Sturdy Metal Design: Merely 0.4 inch thick. All-Aluminum anti-scratch model delivers remarkable strength and durability, keeping this portable hard drive running cool and quiet.
- Compatibility: It is compatible with Microsoft Windows 7/8/10, and provides fast and stable performance for PC, Laptop.
- Improve PC Performance: Powered by USB 3.0 technology, this USB hard drive is much faster than - but still compatible with - USB 2.0 backup drive, allowing for super fast transfer speed at up to 5 Gbit/s.
- Plug and Play: This external drive is ready to use without external power supply or software installation needed. Ideal extra storage for your computer.
- What's Included: Portable external hard drive, 19-inch(48.26cm) USB 3.0 hard drive cable, user's manual, 3-Year manufacturer warranty with free technical support service.
Copy or move files and folders
Use Copy-Item for a duplicate and Move-Item to relocate an item. Copying a directory tree requires -Recurse. A different destination filename also renames an item during a move.
Copy-Item -Path C:Datareport.csv -Destination C:Backupreport.csv
Copy-Item C:DataProject -Destination C:BackupProject -Recurse
Move-Item -Path C:Dataold.txt -Destination C:Dataarchive.txt
An existing destination may cause an operation to fail or require -Force, depending on the command and situation. Check the destination with Test-Path, and try the operation on a small sample before applying it to many items. See Microsoft’s Copy-Item and Move-Item references for command details.
Delete files and directory trees carefully
Remove-Item deletes an item. Add -Recurse to remove a directory and its contents:
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 【Versatile Storage Expansion – For Gaming, Work & Everyday Use】 Running out of space on your PS5 or Xbox Series X/S? This external hard drive lets you store and play PS4 / Xbox One games directly, instantly freeing up your console’s internal storage for next‑gen titles. At the same time, it handles work file backups, media libraries, and cross‑device data transfers with ease. One drive, all your needs. *(Note: PS5 / Xbox Series X|S games cannot be run or stored directly from the external hard drive. However, by offloading your PS4 / Xbox One games, you can free up valuable space for newer titles.)*
- 【Patented Silicone Sleeve – Data Protection You Can Count On】 Worried about drops? We’ve got you covered. The patented built‑in silicone sleeve acts like a shock‑absorbing armor, cushioning your drive against bumps and falls. Whether it’s important work documents, precious family photos, or hard‑earned game saves, your data deserves this level of protection.
- 【Plug & Play, Compatible with Computers & Consoles】 No complicated setup—just plug in and go. Works seamlessly with Windows, Mac, and Linux computers, as well as PS4, PS5, Xbox One, and Xbox Series X/S. Process files at the office, back up data at home, or enjoy gaming in your downtime—one drive handles all your devices, simply and hassle‑free.
- 【USB 3.0 Ultra‑Fast Transfer – No More Waiting】 Tired of watching progress bars crawl? With USB 3.0 speeds up to 5Gbps, large files transfer in seconds. Whether you’re moving work documents, transferring hundreds of gigs of games, or backing up a year’s worth of photos, you get more done in less time.
- 【Sleek, Lightweight, and Ready to Go】 Weighing just 0.16 kg—lighter than a can of soda—this compact drive features a stylish mirror‑and‑frosted finish. Toss it in your bag and go, whether you’re heading to the office, visiting a friend for a gaming session, or giving a presentation on the road.
Remove-Item -Path .old.log
Remove-Item -Path C:TempDeleteMe -Recurse
Without -Recurse, removing a directory that contains children can prompt for confirmation. For a safer first pass, use the common -WhatIf parameter to preview the proposed operation; use -Confirm when you want PowerShell to ask before proceeding.
Remove-Item -Path C:TempDeleteMe -Recurse -WhatIf
Remove-Item -Path C:TempDeleteMe -Recurse -Confirm
Review the exact path before a recursive deletion. A mistyped or overly broad path can affect more files than intended.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Quick cmdlet comparison
| Task | Cmdlet | Useful controls | Effect |
|---|---|---|---|
| Inspect items | Get-ChildItem |
-Recurse, -Depth, -Force, -Filter, -File, -Directory |
Lists matching files and folders |
| Create | New-Item |
-ItemType File or Directory |
Creates an item of the selected type |
| Read | Get-Content |
-Raw, -Tail, -TotalCount, -Encoding, -AsByteStream |
Reads lines, text as one string, selected lines, or bytes |
| Replace contents | Set-Content |
-Value |
Replaces existing content |
| Append contents | Add-Content |
-Value |
Adds content after existing content |
| Duplicate | Copy-Item |
-Recurse for directory trees |
Copies items to a destination |
| Relocate or rename | Move-Item |
Set the destination path or filename | Moves an item; a changed destination name renames it |
| Delete | Remove-Item |
-Recurse, -WhatIf, -Confirm |
Removes an item, optionally with its descendants |
Microsoft’s task-oriented examples for working with files and folders are in Working with files and folders – PowerShell. For the distinction between item and content cmdlets, see Basic concepts – PowerShell, Chapter 3.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

