Move and Rename Files in PowerShell: Move-Item Explained
Renaming and relocating files are common tasks. Learn the safe way to do both at once.
How It Works
Move-Item does two things: rename files and move them to different folders. In PowerShell, both operations are the same command—you just change the destination path or name.
When you move a file to the same folder with a different name, that's a rename. When you move it to a different folder, that's relocation.
Code Examples
Rename a File
# Rename file.txt to document.txt (stays in same folder)
Move-Item "file.txt" "document.txt"
# Shorter version using current path
Move-Item file.txt document.txt
Move File to Another Folder
# Move file to archive folder
Move-Item "file.txt" "C:\archive\file.txt"
# Move AND rename in one step
Move-Item "file.txt" "C:\archive\document_old.txt"
Move and Rename Together
# Move to new folder AND give it a new name
Move-Item "C:\current\report.xlsx" "C:\archive\report_2026.xlsx"
Most Used Options
- -Path - The file to move
- -Destination - Where to move it to
- -Force - Overwrite if destination already exists
- -Confirm - Ask for confirmation before moving
The Trick: Power Usage
Always copy first for important files! Instead of moving directly:
# Risky - one-way operation
Move-Item "important.txt" "archive\important.txt"
# Safe - you have a backup
Copy-Item "important.txt" "archive\important.txt"
Get-ChildItem archive\important.txt # Verify copy worked
Remove-Item "important.txt" # Only delete after verifying copy exists
This pattern protects you from losing files. Use it for anything valuable!
Learn It Through Practice
Stop reading and start practicing right now:
The interactive environment lets you type these commands and see real results immediately.
Next in PowerShell for Beginners
This is part of the PowerShell for Beginners series:
- Getting Started - Your first commands
- Command Discovery - Find what exists
- Getting Help - Understand commands
- Working with Files - Copy, move, delete
- Filtering Data - Where-Object and Select-Object
- Pipelines - Chain commands together
Related Resources
Summary
You now understand:
- How this command works
- The most common ways to use it
- One powerful trick to level up
- Where to practice hands-on
Practice these examples until they feel natural. Then tackle the next command in the series.
Ready to practice? Head to the interactive environment and try these commands yourself. That's how it sticks!
What PowerShell commands confuse you? Drop it in the comments!
Top comments (0)