If your Downloads folder looks like a war zone π (PDFs + images + zip files everywhere), youβre not alone.
So I built a beginner-friendly Python script that automatically:
β
Organizes files into folders (PDFs / Images / Docs / Zips / Videos / Sheets)
β
Creates a folder for todayβs date (YYYY-MM-DD)
β
Renames every file with a timestamp (date/time)
β
Prevents overwriting duplicates (_1, _2, _3β¦)
Result: your Downloads folder becomes clean, sorted, and searchable β
βΆοΈ Video Tutorial (Silent Coding / No Talking)
I recorded a quick walkthrough showing the before β code β run β after.
πΊ Watch it here: https://youtu.be/A3Yz100IbLw
(You can also check my channel: https://www.youtube.com/@CodeGees
)
Downloads/
Images/2026-01-16/2026-01-16_14-20-05_photo.png
PDFs/2026-01-16/2026-01-16_14-20-05_report.pdf
Zips/2026-01-16/2026-01-16_14-20-05_project.zip
import os
from datetime import datetime
β Downloads folder
downloads_folder = os.path.join(os.path.expanduser("~"), "Downloads")
β Today's date folder
today_date = datetime.now().strftime("%Y-%m-%d")
β File categories
file_categories = {
"PDFs": (".pdf",),
"Images": (".png", ".jpg", ".jpeg", ".webp"),
"Docs": (".docx", ".txt"),
"Zips": (".zip", ".rar", ".7z"),
"Videos": (".mp4", ".mov"),
"Sheets": (".xlsx", ".csv"),
}
β Loop through downloads
for filename in os.listdir(downloads_folder):
old_path = os.path.join(downloads_folder, filename)
# Skip folders
if os.path.isdir(old_path):
continue
# Skip shortcuts/temp/system files
if filename.lower().endswith((".lnk", ".tmp", ".ini")):
continue
# Find file extension
file_ext = os.path.splitext(filename)[1].lower()
# Pick category folder
category_name = next(
(name for name, exts in file_categories.items() if file_ext in exts),
"Other"
)
# Create target folder (type + date)
target_folder = os.path.join(downloads_folder, category_name, today_date)
os.makedirs(target_folder, exist_ok=True)
# Create timestamp rename
file_name, ext = os.path.splitext(filename)
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
new_path = os.path.join(target_folder, f"{timestamp}_{file_name}{ext}")
# Avoid overwriting duplicates
counter = 1
while os.path.exists(new_path):
new_path = os.path.join(target_folder, f"{timestamp}_{file_name}_{counter}{ext}")
counter += 1
# Rename + move
os.rename(old_path, new_path)
print("β
", filename, "β", category_name)
print("\nπ Done! Downloads are now organized by type + date."
β Try it Yourself
Save the file as: downloads_folder_organizer.py
Run it:
python downloads_folder_organizer.py
Top comments (0)