BSPLIT — Split files into smaller files.

Syntax:
BSPLIT /D:dir /E /F:n /N:n /O /P /Q /S:size /X:prefix filename…

/D:diroutput directory
/Eno error messages
/F:nextension numbering format
/N:nnumber of splits
/Ooverwrite existing files
/Poutput to source file’s path
/Qquietly
/S:sizesplit size
/X:prefixextension prefix
filename…files to split

BSPLIT divides a file into multiple smaller files. You can split at a specified size (/S:), or into a specified number of files (/N:). You cannot combine /N: and /S:.

You must supply a filename. Wildcards and directory aliases are supported, and you may have more than one filename on the command line. The output directory defaults to the current directory.

BSPLIT is short for “binary split”. It splits files by byte size. It does not support splitting by lines or characters. If the input file contains text it may be divided within a line, or possibly even within a character.


/D:dir specifies the directory that the split files will be written to. If this directory does not exist, BSPLIT will attempt to create it for you.

/P writes the split files to the same directory as the original file. It’s like a shorthand for /D:"%@PATH[filename]". If you don’t specify either /D: or /P, the default is to write the split files to the current directory.


/F:n lets you change the way the output files are numbered. The formats are:

0two decimal digits
1three decimal digits
2four decimal digits
3two hexadecimal digits
4three hexadecimal digits
5four hexadecimal digits
6two letters (base-26)
7three letters (base-26)
8four letters (base-26)

Add 32 for uppercase. If you don’t specify a format, the default is three decimal digits. If you specify a prefix with /X:, the prefix will be inserted at the start of the extension.


/S:size specifies the size of the output files. You may give the size as:

nbytes
nkthousands of bytes
nKkilobytes (1,024 bytes)
nmmillions of bytes
nMmegabytes (1,048,576 bytes)
ngbillions of bytes
nGgigabytes (1,073,741,824 bytes)

/N:n instead splits the file into n more-or-less equally-sized pieces. You cannot combine /N: and /S:.


rem    Break BigFile into 500-kilobyte files:
bsplit /s:500K bigfile

rem    Break BigFile into four more-or-less equal files:
bsplit /n:4 bigfile