FileSplit – Open Source command line file splitter

Filesplit is a command line application that splits a file into chunks of whatever size you specify. It can also merge the chunks back into a single file again. I created it to split up oversized log files at work (as log files over 400Mb don’t load up into a text editor too well).

A maximum number of 999 chunks can be generated.

Data is split in binary form so that it works with text files or graphics, executable programs, anything.

To split a file into chunks of 1MB you need to specify the size in K as 1000.

Note: No large file support is included, so filesplit can only split files less than 2Gb.

License: GNU General Public License (GPL)
Programming Language: C++

 

Binary DownloadSizeVersionDate
filesplit-2.0.100.linux.tar54,678b2.0.100March 09, 2003
filesplit-2.0.100.win3288,876b2.0.100March 09, 2003

 

Source DownloadSizeVersionDate
filesplit-2.0.100.tar38,866b2.0.100March 09, 2003

Note: Filesplit compiles for Win32, Linux and MacOSX platforms.

Installation for binary files
LINUX: Place filesplit into “/bin” or “/usr/local/bin” and you can run filesplit from whatever directory you’re in. Note: you’ll need to set executable permissions for filesplit.

WINDOWS: Place filesplit into “C:\Windows\Command” and you can run filesplit from whatever directory you’re in.

Note: If you don’t wish to add filesplit to your Command/bin directory, place filesplit into the directory containing the file you wish to split, and run filesplit from there. Note, when running the program in this way on Linux you’ll need to type “./filesplit” rather than just “filesplit”.

Splitting a file

To split a file, use the following arguments: filesplit -s (source) (size in k) [(destination)]

(source) is the name of the file you wish to split,
(size in k) is the maximum size you wish each chunk to be,
[(destination)] is where you want the chunks to go.

The destination argument is optional, if you don’t specify this then the chunks will be created in the same directory as the source file. —

Example…

If you have a file named “turtle.bmp” which is 80k, and you wanted to split it into 10k chunks, you’d do the following…

filesplit -s turtle.bmp 10
The output is as follows…

[user@localhost]$ filesplit -s turtle.bmp 10

turtle.bmp_001.cnk
turtle.bmp_002.cnk
turtle.bmp_003.cnk
turtle.bmp_004.cnk
turtle.bmp_005.cnk
turtle.bmp_006.cnk
turtle.bmp_007.cnk
turtle.bmp_008.cnk
turtle.bmp_009.cnk

* DONE *

[user@localhost]$

Merging a file

To merge a file, use the following arguments:

-m (source) [(destination)]

(source) is the name of the file you wish to merge. This can be the name of any chunk file (e.g. “whatever.exe_003.cnk”) or just the name of the file without the “.cnk” extension (e.g. “whatever.exe”).
[(destination)] is where you want the chunks to go.

The destination argument is optional, if you don’t specify this then the merged file will be restored to the same directory as the chunk files.

Example…

If you have a load of chunks starting with the filename “turtle.bmp”, having the .cnk extension (eg “turtle.bmp_001.cnk”), and you wish to merge them back into a file called “turtle.bmp”, you’d do the following…

filesplit -m turtle.bmp

The output is as follows…

[user@localhost]$ filesplit -m turtle.bmp
Merging chunks into turtle.bmp…

turtle.bmp_001.cnk
turtle.bmp_002.cnk
turtle.bmp_003.cnk
turtle.bmp_004.cnk
turtle.bmp_005.cnk
turtle.bmp_006.cnk
turtle.bmp_007.cnk
turtle.bmp_008.cnk
turtle.bmp_009.cnk

* DONE *
[user@localhost]$

Automerge
If you associate “.cnk” files with filesplit (so that they’re opened with filesplit when you open them), then filesplit will automatically restore the file into the same directory as the chunks.

If automerge fails for some reason it will generate a text file named FAILED.txt, containing a message such as:

Error: Couldn’t open source file: file.exe_001.cnk