Skip to content

realekansh/FileOrganizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interactive File Organizer

An automated, intelligent, and interactive Python script designed to clean up any messy directory. It organizes loose files into smartly categorized folders and sub-folders based on their extensions, keeping your system tidy while safely handling identical filenames and hidden files.

Features

  • Nested Sub-Folders: Instead of dumping all documents into one large folder, it natively sub-categorizes your files into distinct paths like Documents/Spreadsheets, Documents/PDFs, and Documents/Word Documents. Media files are intuitively moved into standard Pictures, Music, and Videos directories.
  • Interactive Prompts: When executed, the script asks you real-time questions in the terminal:
    • Dotfiles setup: Choose to ignore .dotfiles, group them internally, or route them to a specific external directory.
    • Special Pathways mapping: You can map entire categories (like Videos) or custom individual extensions (like .log or .pdf) to completely distinct hard drives or folders anywhere on your system! If your chosen folder doesn't exist, the script can create it on the spot.
  • Smart Duplicate Prevention: Safe by design—if a file with the same name already exists in the destination folder, the script automatically renames the new file using an incrementing counter (e.g., report (1).pdf, report (2).pdf) eliminating any risk of silent data wiping or overriding.
  • Cross-Platform Compatibility: Uses standard modern pathlib design with error resistance and crash-safe UTF-8 ASCII logging natively supported on Windows Powershell, macOS, and Linux.

Usage

Test Safely First

We included a script that safely generates a dummy directory (test_dir) filled with fake files so you can verify the organizer without risking your real files!

python generate_test_files.py

This will create a test_dir folder. You can then run the organizer on it.

Organizing Your Files

Simply run the script with Python 3 and provide the absolute or relative path to the messy folder you want to organize:

python file_organizer.py "/path/to/your/messy_folder"

Example Run

D:\> python file_organizer.py C:\Users\Someone\Downloads
Target directory: C:\Users\Someone\Downloads
Do you want to handle dotfiles? (Y/n): y
Do you like to move .dotfiles to a special pathway? (Y/n): n
Would you like to mention any special pathways for certain categories or extensions? (Y/n): n

Organizing...
Moved: financial_report.xlsx -> Documents/Spreadsheets/
Moved: vacation.jpg -> Pictures/
Moved: invoice.pdf -> Documents/PDFs/

[OK] Organized 3 files in C:\Users\Someone\Downloads

Category Structure

By default, files are sorted natively as follows (unless you choose Special Pathways):

  • Documents/
    • PDFs/ (.pdf)
    • Text Files/ (.txt, .rtf, .md)
    • Spreadsheets/ (.xls, .xlsx, .csv, .ods)
    • Word Documents/ (.doc, .docx, .odt)
    • Presentations/ (.ppt, .pptx, .odp)
  • Pictures/ (.jpg, .png, .gif, .svg...)
  • Videos/ (.mp4, .mkv, .avi...)
  • Music/ (.mp3, .wav, .flac...)
  • Archives/ (.zip, .tar, .gz, .rar...)
  • Code/ (.py, .js, .html, .css...)
  • Packages/ (.deb, .rpm, .appimage...)
  • Dotfiles/ (hidden files starting with .)
  • Others/ (unrecognized file extensions)

About

Your personal desktop maid! An interactive CLI tool that automatically cleans up messy directories and sorts your files into neat, structured folders.

Resources

License

Stars

Watchers

Forks

Contributors

Languages