We all know that feeling. Your Downloads folder looks like a digital landfill. Documents that don’t belong together are piled on top of each other, like that pile of laundry you just keep adding to. It’s like the Bermuda Triangle, but for files. And let’s be real — you can’t keep justifying it with the “I’ll deal with it later” excuse. “Later” never comes.
It’s time to take control with this ultra-powerful PowerShell CLI. This script will automatically sort your Downloads folder into neat, categorized folders based on file types (because, why not?) — and it’ll even rename files that are far too embarrassing for your hard drive.
Full Script: Your Downloads Folder, But Actually Organized
# Define the menu function
function Show-Menu {
Clear-Host
Write-Host "===================================="
Write-Host " The Legendary File Sorter™"
Write-Host "===================================="
Write-Host "1. Sort Downloads (Become a hero)"
Write-Host "2. Rename Files (You know you need this)"
Write-Host "3. Exit (Let’s be real, you need a break)"
Write-Host "===================================="
Write-Host "Pick an option [1-3], and stop being a mess:"
}
# Function to create folders for various file types
function Create-Folders {
$downloadsPath = [System.Environment]::GetFolderPath('UserProfile') + "\Downloads"
$folders = @("Documents", "Images", "Videos", "Audio", "Archives", "Executables", "Others")
# Create the folders if they don’t exist
foreach ($folder in $folders) {
$folderPath = Join-Path $downloadsPath $folder
if (-not (Test-Path $folderPath)) {
New-Item -ItemType Directory -Path $folderPath | Out-Null
}
}
Write-Host "Folders created like a boss. Your Downloads folder is no longer a dumpster fire."
Read-Host "Press Enter to return to the menu"
}
# Function to move files into the correct folders based on file type
function Move-Files {
$downloadsPath = [System.Environment]::GetFolderPath('UserProfile') + "\Downloads"
$fileTypes = @{
"Documents" = @("pdf", "docx", "txt", "xls", "xlsx", "ppt", "pptx")
"Images" = @("jpg", "png", "gif", "bmp", "tiff", "jpeg")
"Videos" = @("mp4", "avi", "mkv", "mov")
"Audio" = @("mp3", "wav", "flac")
"Archives" = @("zip", "rar", "tar", "gz")
"Executables" = @("exe", "msi", "apk", "bat")
"Others" = @("exe", "dll", "bak", "iso")
}
# Move files to the corresponding folder based on their extension
foreach ($fileType in $fileTypes.Keys) {
$folderPath = Join-Path $downloadsPath $fileType
$extensions = $fileTypes[$fileType]
foreach ($extension in $extensions) {
$filesToMove = Get-ChildItem -Path $downloadsPath -File -Filter "*.$extension"
foreach ($file in $filesToMove) {
Write-Host "Moving $($file.Name) to $fileType folder... like a hero."
Move-Item -Path $file.FullName -Destination $folderPath
}
}
}
Write-Host "Your Downloads folder is now the epitome of sophistication. High five!"
Read-Host "Press Enter to return to the menu"
}
# Function to rename files that are ridiculous and clearly the product of procrastination
function Rename-Files {
$downloadsPath = [System.Environment]::GetFolderPath('UserProfile') + "\Downloads"
# Get all files in Downloads
$filesToRename = Get-ChildItem -Path $downloadsPath -File
foreach ($file in $filesToRename) {
# If file name is embarrassingly long, we’ll shorten it
if ($file.Name.Length -gt 30) {
$newName = $file.Name.Substring(0, 30) + "..." + $file.Extension
Rename-Item -Path $file.FullName -NewName $newName
Write-Host "Renaming $($file.Name) to $newName because no one needs that kind of embarrassment."
}
}
Write-Host "Your files are now renamed like an adult who knows what they’re doing."
Read-Host "Press Enter to return to the menu"
}
# Main script to loop through menu
do {
Show-Menu
$userChoice = Read-Host
switch ($userChoice) {
'1' { Create-Folders; Move-Files }
'2' { Rename-Files }
'3' { Write-Host "Exiting... You’ve done enough. Go enjoy your semi-organized life." }
default {
Write-Host "Invalid choice. Try not to embarrass yourself next time."
Start-Sleep -Seconds 2
}
}
} while ($userChoice -ne '3')
What’s So Impressive About This CLI?
- Show-Menu Function: A clean and simple menu that lets you take control of your digital chaos. Pick an option to do something impressive — or just pretend you’re doing something important when your mom walks in.
- Create-Folders Function: You’ll create organized folders for different file types, which is honestly something you should have done years ago. But hey, better late than never. Now your Downloads folder won’t be an embarrassment to your digital legacy.
- Move-Files Function: Watch as your files are expertly sorted into their rightful folders. Are you proud of yourself yet? You should be. This script will:
- Put documents in the Documents folder (duh).
- Move images to the Images folder.
- Move videos to the Videos folder, so your computer doesn’t explode with media overload.
4. Rename-Files Function: Look, we’ve all been there. You download files named file123456789_v3_final-final-final2023.pdf
or something equally ridiculous. This function will rename those files to make them look more professional (even if your personal life is still in shambles).
Main Loop: The script keeps running until you’re done pretending you have your life together. Hit exit, and bask in the glow of your digitally organized life for exactly 30 seconds before you let everything fall apart again.
How to Use This Legend-Worthy Script
Save the script as DownloadsOrganizer.ps1.
Run it by opening PowerShell and typing:
- powershell
.\DownloadsOrganizer.ps1
Select an option:
- Option 1: Sort your downloads into proper folders, and feel like a digital superhero.
- Option 2: Rename your embarrassing files to something more acceptable, because no one needs to see
Final_Final_Final_Report.pdf
. - Option 3: Exit, and pretend you’ve got your life under control (for today at least).
Real Talk:
- Permissions: If you’re trying to organize system files, step back. This script is for your personal mess.
- Error Handling: It won’t break your computer, but it won’t make you a coffee either. If something goes wrong, PowerShell will let you know.
- Customization: Want to add more file types or folders? You can do that. But only if you’re ready to commit to organizing your life.
Hashtags:
#OrganizeYourDownloads #PowerShellHero #FileNamingGoals #TechMess #DigitalOverhaul #ProcrastinationFix #OrganizeLikeAPro #MessyLifeNoMore #FileSortingChampion #AdultingWin
Learn more PowerShell CLI: Organizing Your Downloads Folder (Because You’re Not a Total Disaster)