Transform the chaos of recovered files into beautiful, organized perfection.
PhotoRec is amazing at recovering lost files, but terrible at organizing them. You end up with thousands of files scattered across numbered directories with cryptic names. PhotoRec Organizer fixes that mess by creating a beautiful, logical file structure that makes sense. There are 2 versions - v1 and v2. V1 output folder structure: ORDER/[Extension]/[Size-Bucket]/[rec-folder-number][filename] V2 output folder structure: ORDER/[Extension]/[Year-Month]/[Size-Bucket]/[rec-folder-number][filename]
recup_dir.1/
├── f001234.jpg
├── f001235.pdf
├── f001236.mp4
└── ...
recup_dir.2/
├── f002456.png
└── ...
ORDER/
├── jpg/
│ ├── 2015-09/
│ │ ├── SMALL/
│ │ │ └── f001234.jpg
│ │ └── MEDIUM/
│ │ └── f001255.jpg
│ └── 2016-10/
│ └── LARGE/
│ └── f0012312.jpg
├── pdf/
│ └── 2024-03/
│ └── MEDIUM/
│ └── r0012224.pdf
└── mp4/
└── 2023-12/
└── HUGE/
└── f006234.mp4
- 🏷️ Smart File Naming: Files prefixed with recovery directory number
- 📅 Time-Based Organization: Automatically sorts by year-month from file timestamps
- 📏 Intelligent Size Buckets: TINY → SMALL → MEDIUM → LARGE → HUGE
- 🔍 Multi-Platform: Works on whatever runs BASH
- ⚡ Fast Processing: Handles thousands of files efficiently
- 🛡️ Conflict Resolution: Handles duplicate filenames (due to the naming prefix)
- 📊 Progress Tracking: Real-time progress updates and statistics (buggy a bit :-| )
- ⏯️ Allows Resume: The script is moving the files so you can stop it anytime and resume after
| Bucket | Size Range | Typical Files |
|---|---|---|
| TINY | 0 - 100KB | Thumbnails, text files, configs |
| SMALL | 100KB - 1MB | Documents, compressed images |
| MEDIUM | 1MB - 10MB | Photos, presentations |
| LARGE | 10MB - 50MB | High-res photos, short videos |
| HUGE | 50MB+ | Long videos, archives, disk images |
Before running this make a backup of your recovery - the script is MOVING the files, so it will be good to run it over a backup. There is no warranty of any kind of using this script - I just can tell you that it did a great job for me
./photorec_organizer.sh /path/to/your/photorec/recovery/folder./photorec_organizer.sh ~/Desktop/photorec_recoveryThe script will:
- Scan all
recup_dir.*folders in your source directory - Create an
ORDERdirectory with organized files - Show progress as it processes your files
- Display a summary of what was organized
The script creates a logical hierarchy:
ORDER/
└── [FILE_EXTENSION]/
└── [YEAR-MONTH]/
└── [SIZE_BUCKET]/
└── [RECUP_NUMBER]_[ORIGINAL_FILENAME]
Examples:
ORDER/jpg/2024-03/MEDIUM/5_IMG_1234.jpgORDER/pdf/2023-11/SMALL/12_document.pdfORDER/mp4/UNKNOWN/HUGE/3_video.mp4(for files without detectable dates)
The script intelligently extracts dates from:
- File modification timestamps (primary method)
- Fallback to "UNKNOWN" for undatable files
Starting PhotoRec file organization...
Source directory: /home/user/recovery
Target directory: ORDER
Found 2,847 files to process
Processing recup_dir.1 (number: 1)...
Processing recup_dir.2 (number: 2)...
...
Processed 2,800/2,847 files...
File organization complete!
Processed: 2,847 files
Files organized in: ORDER
Size bucket distribution:
TINY: Found in 15 different extension/date combinations
SMALL: Found in 28 different extension/date combinations
MEDIUM: Found in 42 different extension/date combinations
LARGE: Found in 18 different extension/date combinations
HUGE: Found in 8 different extension/date combinations
- Bash shell (4.0+)
- Linux or macOS
- Standard Unix utilities:
find,stat,date,cut
Found a bug? Have an idea? Pull requests and issues are welcome!
This project is licensed under the MIT License - feel free to use, modify, and distribute.
- Run on a copy first: Test with a small subset of files before processing everything
- Check timestamps: Files might be organized by recovery date, not original creation date
- Large datasets: For huge recoveries (10k+ files), consider running overnight
- Multiple runs: Safe to run multiple times - existing files won't be overwritten
- Built for the awesome PhotoRec recovery tool
- Inspired by everyone who's ever faced the "organized chaos" of file recovery
- Written (also this readme) with the help of https://claude.ai/
Built with ❤️ for data recovery heroes everywhere