Skip to content

PoisonMunna/FileOrganizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ File Organizer

Python Version License Platform

A professional, feature-rich file organization tool that automatically sorts files into categorized folders. Supports multiple organization methods, duplicate detection, undo functionality, and detailed logging.

Features

  • Multiple Organization Methods - Category, Date, Size, First Letter, or Smart combination
  • Recursive Scanning - Organize files in subdirectories
  • Dry Run Mode - Preview changes before executing
  • Undo Functionality - Revert last organization operation
  • Duplicate Detection - SHA256 hash-based duplicate finding
  • Detailed Statistics - Track files moved, folders created, size processed
  • Comprehensive Logging - Save detailed operation logs
  • History Tracking - JSON-based operation history
  • Color-coded Output - Easy-to-read console output
  • Professional Error Handling - Graceful error recovery

Quick Start

Prerequisites

  • Python 3.7 or higher
  • No external libraries required (uses only built-in modules)

Installation

  1. Clone the repository: git clone https://github.com/poisonmunna/fileorganizer.git
    cd FileOrganizer

  2. Run the application:
    python file_organizer.py

Basic Usage

Interactive mode (recommended for beginners)

image

Organization Methods

Method Description Example Structure
Category Sorts by file type Images, Documents, Code
Date Sorts by modification date ByDate 2024 December 25
Size Sorts by file size BySize Tiny, BySize Large
Letter Sorts by first letter ByLetter A, ByLetterB
Smart Category + Date combination ByDate 2024 December 25 Images

File Categories Supported

๐Ÿ“ท Images - jpg, png, gif, bmp, svg, ico, webp, raw, tiff, heic
๐Ÿ“„ Documents - pdf, docx, doc, txt, md, rtf, odt, tex
๐Ÿ’ป Code - py, js, html, css, cpp, java, php, rb, go, json, xml
๐Ÿ—œ๏ธ Archives - zip, rar, 7z, tar, gz, bz2, xz, iso
๐ŸŽฌ Videos - mp4, mkv, avi, mov, wmv, flv, webm, m4v
๐ŸŽต Music - mp3, wav, flac, aac, ogg, m4a, wma, opus
โš™๏ธ Executables - exe, msi, app, deb, rpm, dmg, pkg
๐Ÿ“Š Spreadsheets - xls, xlsx, csv, ods, numbers
๐Ÿ“ฝ๏ธ Presentations - ppt, pptx, odp, key
๐Ÿ“š Ebooks - epub, mobi, azw, fb2
๐Ÿ—„๏ธ Databases - db, sqlite, sql, mdb
๐Ÿ’พ Backups - bak, old, backup, tmp
๐ŸŽจ Design - psd, ai, eps, sketch, fig, xd
๐Ÿ”ค Fonts - ttf, otf, woff, woff2, eot
๐Ÿ“ง Email - eml, msg, pst
๐ŸŒ Web - html, htm, css, js, php
๐Ÿ“ฑ Mobile - apk, ipa, xapk
๐ŸŽฎ Games - gam, save, dat
๐Ÿ–ผ๏ธ Vector - ai, eps, svg, cdr
๐Ÿ“ฆ Packages - whl, egg, gem, jar ๐Ÿ“ Logs - log, out, err
๐Ÿ”ง Config - cfg, conf, ini, env, properties โ“ Others - Any other file types

Interactive Menu

======================================================================

 ๐Ÿ—‚๏ธ  FILE ORGANIZER PRO - Interactive Mode

======================================================================

๐Ÿ“‚ Enter folder path to organize:
C:\Users\YourName\Downloads

๐Ÿ“Œ Select Organization Method:

  1. By Category (Images, Documents, Code, etc.)
  2. By Date (Year/Month/Day structure)
  3. By Size (Tiny to Huge)
  4. By First Letter (A-Z)
  5. Smart (Category + Date combination)
  6. Recursive (organize all subfolders)

๐Ÿ‘‰ Choose (1-6): 1

๐Ÿ” Perform dry run first? (y/n): n

Example Output

======================================================================

๐Ÿ“ FILE ORGANIZER PRO - C:\Users\YourName\Downloads

======================================================================


โœ… Moved: vacation.jpg โ†’ ๐Ÿ“ท Images/vacation.jpg
โœ… Moved: resume.pdf โ†’ ๐Ÿ“„ Documents/resume.pdf
โœ… Moved: script.py โ†’ ๐Ÿ’ป Code/script.py
โœ… Moved: music.mp3 โ†’ ๐ŸŽต Music/music.mp3

Progress: 50/50

======================================================================

๐Ÿ“Š ORGANIZATION SUMMARY

======================================================================

๐Ÿ“ Directory: C:\Users\YourName\Downloads
โฑ๏ธ Time taken: 3.45 seconds
โœ… Files moved: 48
โญ๏ธ Files skipped: 2
๐Ÿ“ฆ Total size moved: 245.67 MB
๐Ÿ”„ Duplicates handled: 3
โŒ Errors: 0
๐Ÿ“‚ New folders created: 8

๐Ÿ“ Created folders:
โ€ข ๐Ÿ“ท Images
โ€ข ๐Ÿ“„ Documents
โ€ข ๐Ÿ’ป Code
โ€ข ๐ŸŽต Music
โ€ข ๐ŸŽฌ Videos
โ€ข ๐Ÿ—œ๏ธ Archives
โ€ข โ“ Others

๐Ÿ“„ Log saved to: C:\Users\YourName\Downloads\organizer_log_20241215_103020.txt

Command Line Arguments

Argument Description
directory Path to folder to organize
--method, -m Organization method (category, date, size, letter, smart)
--dry-run, -d Preview changes without moving files
--recursive, -r Process subdirectories recursively
--undo, -u Undo last organization operation
--quiet, -q Reduce output verbosity
--interactive, -i Launch interactive mode

Usage Examples

image

Advanced Features

Duplicate Detection

The tool uses SHA256 hashing to identify duplicate files and handles them by adding number suffixes.

Undo Functionality

Every organization operation is logged and can be undone: python file_organizer.py ~/Downloads --undo

History Tracking

All operations are saved in organization_history.json for future reference.

Log Files

Detailed logs are saved as organizer_log_YYYYMMDD_HHMMSS.txt with timestamps.

File Size Categories

  • Tiny: < 100 KB
  • Small: 100 KB - 1 MB
  • Medium: 1 MB - 10 MB
  • Large: 10 MB - 100 MB
  • Very Large: 100 MB - 1 GB
  • Huge: > 1 GB

Safety Features

  • Ignores system files (desktop.ini, Thumbs.db, .DS_Store)
  • Skips organization folders to prevent recursion
  • Handles permission errors gracefully
  • Prevents moving the script itself
  • Duplicate filename handling

Before Organization Example

Downloads/
โ”œโ”€โ”€ vacation_2024.jpg
โ”œโ”€โ”€ resume_final.pdf
โ”œโ”€โ”€ project_script.py
โ”œโ”€โ”€ data_analysis.csv
โ”œโ”€โ”€ setup.exe
โ””โ”€โ”€ random_file.xyz

After Category Organization

Downloads/
โ”œโ”€โ”€ ๐Ÿ“ท Images/
โ”‚ โ””โ”€โ”€ vacation_2024.jpg
โ”œโ”€โ”€ ๐Ÿ“„ Documents/
โ”‚ โ”œโ”€โ”€ resume_final.pdf
โ”‚ โ””โ”€โ”€ data_analysis.csv
โ”œโ”€โ”€ ๐Ÿ’ป Code/ โ”‚ โ””โ”€โ”€ project_script.py
โ”œโ”€โ”€ โš™๏ธ Executables/
โ”‚ โ””โ”€โ”€ setup.exe
โ””โ”€โ”€ โ“ Others/
โ””โ”€โ”€ random_file.xyz

Project Structure

file-organizer-pro/
โ”‚
โ”œโ”€โ”€ file_organizer.py # Main application
โ”œโ”€โ”€ README.md # Documentation
โ”œโ”€โ”€ LICENSE # MIT License
โ””โ”€โ”€ .gitignore # Git ignore file

Troubleshooting

Permission Denied Error

  • Run terminal as administrator (Windows) or use sudo (Linux/Mac)
  • Close any programs using the files

Files Not Moving

  • Check if files are in use by another program
  • Verify the directory path is correct
  • Try dry run mode first: --dry-run

Undo Not Working

  • Ensure you haven't moved or deleted the history file
  • History file is located in the organized directory: organization_history.json

Performance

  • Files per second: 50-100 files (depending on storage speed)
  • Memory usage: ~50 MB for 10,000 files
  • Supports: Unlimited file count

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE file for more information.

Contact

Your Name - 123razz321@gmail.com

Project Link: https://github.com/poisonmunna/FileOrganizer

Show Your Support

If this project helped you organize your files, please give it a star on GitHub!


Made with Python | Keep your files organized!

About

A professional, feature-rich file organization tool that automatically sorts files into categorized folders. Supports multiple organization methods, duplicate detection, undo functionality, and detailed logging.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors