繁體中文 | 简体中文 | 日本語 | Español | Deutsch
Split files in an oversized folder into evenly distributed subfolders by filename — built for folders too large to load smoothly in Finder / Explorer. Works for any file type: photos, documents, archives, logs, datasets, and more. Supports SMB shares, dry-run preview, and re-splitting of existing partitions.
- Name-based grouping — Related files sharing the same prefix+number (e.g.,
report_001.pdf,report_001.xlsx) stay together - Natural sort —
file2sorts beforefile10, not lexicographically - Even distribution — File groups are spread as evenly as possible across target folders
- Dry-run mode — Preview the result without moving any files
- Re-splitting — Already-split
part_*folders are detected and can be re-distributed - Recursive scanning — Optionally scan the entire directory tree
- SMB / network share safe — Uses
os.renamefor same-filesystem moves, falling back to copy+delete - macOS junk filtering — Automatically skips
.DS_Storeand._*files - Duplicate protection — If a filename already exists in the target, renames to
xxx__dupN.ext - Empty folder cleanup — Removes empty old
part_*folders after redistribution
- Oversized folders — A single folder with 10,000+ files that takes forever to open? Split it into smaller chunks.
- Photo collections — Distribute RAW/ARW/HIF/XMP files across multiple drives or network shares.
- Log archives — Partition millions of log files by name range for easier browsing.
- Dataset preparation — Split training data into balanced shards.
- Any large flat folder — If a folder is too big to load, SplitFolder can help.
- Python 3.7+
No external dependencies — uses only the standard library.
git clone https://github.com/LeonJian/SplitFolder.git
cd SplitFolderpython3 main.py /path/to/large/folder -n 10Splits all files into 10 subfolders: part_001_*, part_002_*, ..., part_010_*.
# Split into 5 parts with dry-run preview
python3 main.py /Volumes/Data/Archive -n 5 --dry-run
# Split into 20 parts with custom prefix
python3 main.py /Volumes/Data/Archive -n 20 --prefix batch_
# Recursively scan all subdirectories
python3 main.py /Volumes/Data/Archive -n 10 --recursive
# Re-split existing part folders (detected by default)
python3 main.py /Volumes/Data/Archive -n 40
# Skip empty folder cleanup
python3 main.py /Volumes/Data/Archive -n 10 --no-clean-empty| Option | Default | Description |
|---|---|---|
source |
(required) | Path to the source folder |
-n, --parts |
(required) | Number of target subfolders |
--prefix |
part_ |
Prefix for output folder names |
--recursive |
off | Recursively scan the entire directory tree |
--dry-run |
off | Preview only — do not move files |
--no-clean-empty |
off | Skip cleaning empty old part_* folders |
- Scan — Collects all files from the source folder (and optionally subdirectories)
- Group — Groups files by their name prefix+number (e.g.,
report_001.pdf+report_001.xlsx→ groupreport_001) - Sort — Sorts groups using natural number ordering
- Distribute — Evenly spreads groups across N target folders
- Move — Moves files into their target folders, preserving filenames
- Cleanup — Removes empty old
part_*folders
part_001_report_0001-report_0500/
part_002_report_0501-report_1000/
part_003_report_1001-report_1500/
...
Each folder name shows the range of file groups it contains.