A robust PowerShell utility for splitting large binary files into smaller, manageable chunks. Perfect for handling large files that need to be transferred, stored, or processed in smaller segments.
- 🔧 Flexible Chunk Sizes: Support for KB, MB, GB units with decimal precision
- 📁 Smart Output Management: Automatic directory creation with customizable naming
- 🎯 Progress Tracking: Real-time progress display with completion percentage
- 🔒 Safe Operations: Built-in file validation and optional overwrite protection
- 🎨 Customizable Prefixes: Configure chunk file naming patterns
- 🔇 Quiet Mode: Minimal output for automated scripts
- 📦 Easy Installation: Simple module installation script included
-
Clone or download this repository:
git clone https://github.com/pepistrafforello/ps-splitter.git cd ps-splitter
-
Install as PowerShell module (requires Administrator privileges):
.\Setup-Splitter.ps1 -
Import the module (if not auto-imported):
Import-Module FileSplitter
Split a file into 10MB chunks:
Split-File -InputFile "C:\data\largefile.zip" -ChunkSize 10MB# Split a large archive into 50MB chunks
Split-File -InputFile "backup.tar" -ChunkSize 50MB# Split with custom output location and file naming
Split-File -InputFile "video.mp4" -OutputDirectory "C:\Chunks" -ChunkSize 100MB -ChunkPrefix "video_part_"# Silent operation with automatic overwrite
Split-File -InputFile "database.bak" -ChunkSize 2GB -Overwrite -Quiet# Various size formats supported
Split-File -InputFile "data.bin" -ChunkSize 512KB # Kilobytes
Split-File -InputFile "data.bin" -ChunkSize 1.5GB # Decimal gigabytes
Split-File -InputFile "data.bin" -ChunkSize 1000000 # Raw bytes| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
InputFile |
String | ✅ Yes | - | Path to the file to be split |
OutputDirectory |
String | ❌ No | {filename}_chunks |
Directory for output chunks |
ChunkSize |
String | ❌ No | 1MB |
Size of each chunk (supports KB, MB, GB) |
ChunkPrefix |
String | ❌ No | chunk_ |
Prefix for chunk filenames |
Overwrite |
Switch | ❌ No | false |
Overwrite existing files without prompting |
Quiet |
Switch | ❌ No | false |
Suppress progress output |
Chunks are saved with sequential numbering:
chunk_0001.bin
chunk_0002.bin
chunk_0003.bin
...
With custom prefix:
video_part_0001.bin
video_part_0002.bin
video_part_0003.bin
...
- Windows operating system
- PowerShell 3.0 or higher
- Administrator privileges (for module installation only)
The script uses efficient binary file operations with:
- Buffered reading for optimal memory usage
- Stream-based processing to handle large files
- Progress tracking without significant performance impact
The script includes comprehensive error handling for:
- ❌ Non-existent input files
- ❌ Invalid chunk size formats
- ❌ Insufficient disk space
- ❌ Permission issues
- ❌ Invalid file paths
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Follow PowerShell best practices
- Include appropriate comment-based help
- Add parameter validation where appropriate
- Test with various file sizes and formats
This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.
Author: Giuseppe Strafforello
Email: giuseppe.strafforello@titantechnologies.com
Company: Titan Technologies
- Initial release
- Core file splitting functionality
- Progress tracking and error handling
- Module installation support
Q: "Execution of scripts is disabled on this system"
A: Run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser to allow script execution.
Q: Module not found after installation
A: Try running Import-Module FileSplitter -Force or restart your PowerShell session.
Q: Access denied during installation
A: Ensure you're running the setup script as Administrator.
Q: Out of disk space errors
A: Check available disk space in the output directory before splitting large files.
⭐ Like this project? Give it a star on GitHub!