Skip to main content

allfileorg

PyPI version Python versions License: MIT

allfileorg is an intelligent, high-speed, and reliable file organization package for your PC and servers. It automatically scans any cluttered directory (e.g. Downloads, Desktop, or custom project folders) and cleanly organizes files into categorized folders: Word documents (.docx, .doc), PDFs (.pdf), Spreadsheets, Images, Videos, Code, Archives, and more.


Key Features

  • 📂 Smart File Categorization: Organizes .docx, .pdf, .png, .xlsx, .zip, .py, and 50+ formats out of the box.
  • ⚡ Zero-Config CLI: Run allfileorg (or fileorg) directly from your command prompt or terminal.
  • 🛡️ Safe by Design:
    • Dry Run Mode: Preview changes before moving any files (--dry-run).
    • Undo / Rollback: Safely revert organized files back to their original positions (--undo).
    • Collision Resolution: Automatically handles file name conflicts without overwriting (file (1).docx).
  • 🔄 Recursive Support: Organize nested folder structures (--recursive).
  • 📅 Date Organization: Optionally organize files by year and month subfolders (--by-date).
  • ⚙️ Custom Rules: Easily supply custom JSON configuration to define your own categories and extensions.
  • 🐍 Clean Python API: Import and use fileorg directly in your Python scripts and pipelines.

Default Category Mapping

Category Formats / Extensions
Documents .docx, .doc, .txt, .rtf, .odt, .tex, .md, .pages, .dotx
PDFs .pdf
Spreadsheets .xlsx, .xls, .csv, .tsv, .ods, .numbers, .xlsm
Presentations .pptx, .ppt, .odp, .key, .ppsx
Images .jpg, .jpeg, .png, .gif, .bmp, .svg, .webp, .tiff, .ico, .heic, .psd, .ai
Videos .mp4, .mkv, .mov, .avi, .wmv, .flv, .webm, .m4v
Audio .mp3, .wav, .aac, .flac, .ogg, .m4a, .wma
Archives .zip, .tar, .gz, .7z, .rar, .bz2, .xz, .iso
Code .py, .js, .ts, .html, .css, .json, .java, .cpp, .c, .cs, .go, .rs, .sql, .sh, .bat
Executables .exe, .msi, .apk, .bin, .dmg, .deb, .appimage
Ebooks .epub, .mobi, .azw, .azw3, .djvu
Fonts .ttf, .otf, .woff, .woff2
Others Unrecognized file extensions

Installation

pip install allfileorg

Or install in editable / development mode locally:

git clone https://github.com/utujesandrine456/allfileorg.git
cd allfileorg
pip install -e .

Command Line Usage (CLI)

Once installed, use the allfileorg command from any terminal:

1. Organize Current Directory

allfileorg

2. Organize a Specific Folder (e.g., Downloads or Desktop)

allfileorg ~/Downloads
# Or on Windows:
allfileorg "C:\Users\username\Downloads"

3. Dry-Run Mode (Preview Before Moving)

allfileorg ~/Downloads --dry-run

4. Organize Recursively (Include Subfolders)

allfileorg ~/Downloads --recursive

5. Undo / Rollback Organization

allfileorg ~/Downloads --undo

6. Move to a Separate Target Directory

allfileorg ~/Downloads --target ~/OrganizedFiles

7. Organize by Date Subfolders

allfileorg ~/Downloads --by-date

Creates structures like Documents/2026/05-May/report.docx.

8. Use Custom Rules JSON

allfileorg ~/Downloads --config custom_rules.json

Python API Usage

You can seamlessly integrate fileorg into your own Python applications.

Quick Start

from fileorg import organize_directory, undo_organization

# Organize a folder
summary = organize_directory("C:/Users/username/Downloads")
print(f"Moved {summary.total_moved} files into categories!")

# Revert organization if needed
reverted, failed, errors = undo_organization("C:/Users/username/Downloads")
print(f"Successfully restored {reverted} files.")

Advanced Usage with FileOrganizer Class

from fileorg import FileOrganizer

organizer = FileOrganizer(
    source_dir="C:/Users/username/Downloads",
    target_dir="C:/Users/username/Organized",
    conflict_strategy="rename",  # "rename", "skip", or "overwrite"
    dry_run=False,
    recursive=True,
    by_date=True,
)

summary = organizer.organize()

print(f"Scanned: {summary.total_files_scanned}")
print(f"Moved:   {summary.total_moved}")
print("Breakdown by category:", summary.category_counts)

Running Tests

Run the included unit test suite:

python -m unittest discover -s tests -p "test_*.py"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for allfileorg 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for allfileorg 1.0.0
File Size Uploaded
allfileorg-1.0.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for allfileorg 1.0.0
File Interpreter ABI Platform
allfileorg-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / allfileorg-1.0.0.tar.gz

Download URL allfileorg-1.0.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
87730542bacb0c947264f6bb361ca487b0438ecc1564bf15ae5f05d938a139d2
BLAKE2b-256 checksum
How to use checksums
9ad7e405a94ced20bb455f41dc7b26c6b9c92a6323f8d9b33fe02cd53b274e71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / allfileorg-1.0.0-py3-none-any.whl

Download URL allfileorg-1.0.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c8166d23438e275a590519648dc6b8d07326703e8afa9d5d4175dc6b0bfce20
BLAKE2b-256 checksum
How to use checksums
83cad13961783d7142577d9b3ace66dd3af609e1b4b6189c8c46e37c15a0b39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page