A smart file organization tool that automatically sorts files into folders based on intelligent filename analysis
Project description
FMORG - Smart File Organization Tool
A highly opinionated command-line tool that automatically organizes your files into folders based on intelligent filename analysis. Perfect for organizing media files, documents, and any other files with structured naming patterns.
Features
- Intelligent Filename Analysis: Extracts meaningful titles from complex filenames
- Smart Pattern Recognition: Automatically filters out TV series patterns (S01E01), years, video formats, codecs, and technical metadata
- Safe File Operations: Creates folders as needed and moves files with conflict resolution
- Configurable Thresholds: Set minimum file count per folder to avoid clutter
- Cross-Platform: Works on Windows, macOS, and Linux
- Colored Terminal Output: Beautiful, easy-to-read output with color coding
- Dry Run Mode: Preview operations before executing them
- User Confirmation: Interactive prompts before making changes
- Simplified Interface: Clean, intuitive CLI without unnecessary subcommands
- Hidden File Handling: Automatically ignores system files like
.gitignoreand.DS_Store
Installation
From Source
git clone https://github.com/Phr33d0m/fmorg.git
cd fmorg
pip install -e .
Development Installation
git clone https://github.com/Phr33d0m/fmorg.git
cd fmorg
pip install -e ".[dev]"
Quick Start
Basic Usage
Organize files in the current directory:
fmorg
Or specify a directory:
fmorg /path/to/files
Dry Run (Preview Changes)
See what would be done without actually moving files:
fmorg --dry-run
Advanced Examples
Organize with a minimum of 2 files per folder:
fmorg /path/to/files --min 2
Recursively scan subdirectories:
fmorg /path/to/files --recursive
Organize to a different output directory:
fmorg /path/to/source --output /path/to/target
Skip confirmation prompts:
fmorg /path/to/files --yes
Command Line Options
| Option | Short | Description | Default |
|---|---|---|---|
--min |
-m |
Minimum files per folder | 1 |
--output |
-o |
Output directory for organized files | Same as input |
--recursive |
-r |
Scan subdirectories recursively | False |
--dry-run |
-d |
Preview without executing | False |
--yes |
-y |
Skip confirmation prompt | False |
--verbose |
-v |
Enable verbose output | False |
--quiet |
-q |
Suppress non-error output | False |
--no-color |
Disable colored output | False |
|
--help |
-h |
Show help message | |
--version |
Show version |
How It Works
Filename Analysis
FMORG intelligently analyzes filenames to extract meaningful titles by:
- Removing TV Series Patterns: Filters out
S01E01,S1E1patterns - Filtering Years: Removes years like
2023,1999 - Removing Quality Indicators: Strips
1080p,4K,HDR, etc. - Cleaning Technical Terms: Removes codecs, sources, release groups
- Normalizing Separators: Converts dots, underscores, hyphens to spaces
- Extracting Latin Content: Keeps only meaningful Latin letter content
Example Transformations
Divine.Love.Deep.Blue.S01E01.2025.2160p.WEB-DL.H265.HDR.AAC-ColorTV.mkv
→ Divine Love Deep Blue
The.Matrix.1999.1080p.BluRay.x264.AC3-XYZ.mp4
→ The Matrix
Breaking.Bad.S01E01.2008.HDTV.x264-LOL.mkv
→ Breaking Bad
File Organization
- Analysis: Files are analyzed and grouped by extracted title
- Planning: Creates a safe plan showing which files will move where
- Validation: Checks for potential issues (permissions, conflicts)
- Execution: Moves files to appropriate folders with conflict resolution
File Categories
FMORG automatically categorizes files by extension:
- Videos:
.mp4,.mkv,.avi,.mov,.wmv,.flv,.webm - Audio:
.mp3,.wav,.flac,.aac,.ogg,.wma,.m4a - Documents:
.pdf,.doc,.docx,.txt,.rtf,.xls,.xlsx,.ppt - Images:
.jpg,.jpeg,.png,.gif,.bmp,.tiff,.svg - Archives:
.zip,.rar,.7z,.tar,.gz,.bz2 - Other: All other file types
Usage Examples
Organizing Media Files
# Organize a directory of TV shows and movies
fmorg /downloads/media --recursive --min 1
# Only organize if there are at least 3 files with the same title
fmorg /downloads --min 3 --dry-run
Development Workflow
# Test your organization strategy
fmorg /test/files --dry-run --verbose
# Execute after review
fmorg /test/files --yes
# Organize to a clean structure
fmorg /messy/downloads --output /organized/library --recursive
Batch Operations
# Quiet mode for scripts
fmorg /auto/organize --quiet --yes
# Detailed logging for troubleshooting
fmorg /problem/files --verbose --dry-run
# Organize current directory with minimal output
fmorg --quiet --yes
Configuration
Environment Variables
FMORG_DEFAULT_MIN: Default minimum files per folderFMORG_NO_COLOR: Disable colored output by defaultFMORG_DEFAULT_DRY_RUN: Default to dry-run mode
Example Configuration
# Set in ~/.bashrc or ~/.zshrc
export FMORG_DEFAULT_MIN=2
export FMORG_NO_COLOR=1
Troubleshooting
Common Issues
"Permission denied" errors:
- Ensure you have read permissions for source files
- Ensure you have write permissions for target directory
"No files found to organize":
- Check that files exist in the specified directory
- Use
--recursiveto include subdirectories - Try
--verboseto see what files are being scanned
Files not being grouped as expected:
- Check that your minimum threshold (
--min) isn't too high - Files with no extractable title will be skipped
- Hidden files (starting with dot) are automatically ignored
Debug Mode
For detailed debugging information:
fmorg /path/to/files --verbose --dry-run
Getting Help
# Show help message
fmorg --help
# Show version
fmorg --version
Acknowledgments
- Built with Click for CLI interface
- Uses Colorama for cross-platform colors
- Tested with pytest
- Formatted with Black and linted with Ruff
License
This project is released under the MIT License.
Contributing
Contributions are welcome, support is not offered. Please feel free to send pull requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fmorg-1.0.0.tar.gz.
File metadata
- Download URL: fmorg-1.0.0.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b5df4f87936c2979d60aff13c4a50329c71492094bd36f1fb8316cf968f6c98
|
|
| MD5 |
58a4528b8ec4c4d27db738ebf4f43142
|
|
| BLAKE2b-256 |
4e9e514d5131bcf977bad20fdae0ea6c2d9c188347ad6e2cbb622eb6dbe8e13a
|
Provenance
The following attestation bundles were made for fmorg-1.0.0.tar.gz:
Publisher:
python-publish.yml on Phr33d0m/fmorg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fmorg-1.0.0.tar.gz -
Subject digest:
1b5df4f87936c2979d60aff13c4a50329c71492094bd36f1fb8316cf968f6c98 - Sigstore transparency entry: 628728348
- Sigstore integration time:
-
Permalink:
Phr33d0m/fmorg@c5580425272a4d30a2aa0366fa16ff94925e161a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Phr33d0m
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c5580425272a4d30a2aa0366fa16ff94925e161a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file fmorg-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fmorg-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f07231f6274bc17bdab8eb1942453fee633bec3bb68b322fedc98aba4138060e
|
|
| MD5 |
bdf3c340e6fc8ff4dbfd161d0687ed1a
|
|
| BLAKE2b-256 |
a36b29f6306784c014bb288af7aaf413d09b1d4e26acfb0c9feebbd0196fe8c7
|
Provenance
The following attestation bundles were made for fmorg-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on Phr33d0m/fmorg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fmorg-1.0.0-py3-none-any.whl -
Subject digest:
f07231f6274bc17bdab8eb1942453fee633bec3bb68b322fedc98aba4138060e - Sigstore transparency entry: 628728350
- Sigstore integration time:
-
Permalink:
Phr33d0m/fmorg@c5580425272a4d30a2aa0366fa16ff94925e161a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Phr33d0m
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c5580425272a4d30a2aa0366fa16ff94925e161a -
Trigger Event:
workflow_dispatch
-
Statement type: