Skip to content
GSplit

Command line: gunitec

Advanced reference

For scripts, servers and Linux terminals.

gunitec is the console version of GUnite. It rebuilds the original file from a piece set, checks a set without writing anything, or prints what a set contains. It needs no window and no WebView2, so it runs on servers, in scripts and on Linux. On Windows the program is gunitec.exe.

It reads sets written by GSplit 4 and GSplit 3, GSplit 1.x sets, and raw sets (.001, HJSplit, 7-Zip, Unix split). The join scripts that GSplit writes next to the pieces (.join.bat and .join.sh) call gunitec for a set with metadata.

To split from a script, see Command line: GSplit and gsplitc.

gunitec <piece> [-o <output>] [-c <file.crc>] [-b <KB>] [-v] [-y] [-k] [-n] [-i] [-q] [--no-sha] [--lang <code>]
gunitec [-n] [-y]
gunitec --ini <file.ini> [-n] [-y]
gunitec --help
gunitec --version

<piece> is any piece of the set. A set is joined from its first piece, which gunitec finds on its own.

OptionMeaning
-o <file>Output file. Default: the set's folder plus the original file name. -o - writes to standard output (see below).
-c <file.crc>A Total Commander .crc file to verify a raw set against.
-b <KB>Buffer size in KB, 1 to 65536. Default 64.
-vVerify only: read every piece, write nothing. A set without a checksum is still walked, with a warning, and only the presence and sizes of the pieces are checked.
-yOverwrite an existing output file.
-kSkip bad pieces (wrong set, short, CRC error) without asking. The output is then incomplete.
-nNon-interactive: never ask, stop at the first problem.
-iInspect only: print the set and exit.
-qQuiet: no progress and no log. Errors still go to standard error.
--no-shaDo not check the SHA-256 of the result against the one stored in the metadata of a GSplit 4 set. Each piece is still checked by its CRC-32, but the result as a whole is no longer checked.
--lang <code>Language of the messages (fr, zh_TW, en). Default: the GSPLIT_LANG environment variable, then the language of the system.
--ini <file.ini>Self-Uniting mode from this .ini file (see below).
-h, --help, -?Print the banner and the usage, exit code 0.
--versionPrint the banner with the version, exit code 0.

An unknown option, a second piece name, or a buffer outside 1 to 65536 prints the usage and exits with code 1.

-i prints the format, the original file name and size, the pieces, the title, author and description, the set id, the version and the checksum, then the list of pieces with their names. A piece that is not found is marked MISSING. For a GSplit 4 set it adds the label (the text typed as the id when it was not a UUID), the split, modification and creation dates in ISO 8601 with their offset, the Unix mode (octal), the Windows attributes (hexadecimal), whether the set is spanned, the text mode, the creator and the SHA-256 stored in the piece metadata. A spanned set read from a piece 2 to n shows Pieces: unknown.

Terminal window
gunitec "E:\pieces\disk1.gsd" -i

-v reads every piece and checks it against the CRC-32 of the piece, and against the SHA-256 of the original when the set carries one. Nothing is written. The exit code tells the result.

Terminal window
gunitec "E:\pieces\disk1.gsd" -v -n
if errorlevel 1 echo The set is damaged or incomplete (code %errorlevel%)
Terminal window
gunitec "E:\pieces\disk1.gsd" -o "D:\restored\film.mkv"
gunitec "E:\pieces\disk1.gsd" -o "D:\restored\film.mkv" -y -n

GSplit writes the output as a <name>.gspart file and moves it onto its final name once it is complete, so a run that is killed or fails never leaves a half-written file under the final name.

A raw set can be checked against a Total Commander .crc file:

Terminal window
gunitec "E:\pieces\report.pdf.001" -c "E:\pieces\report.pdf.crc" -o "D:\restored\report.pdf"

-o - sends the joined file to standard output, so it can go into a pipe without a temporary file.

Terminal window
gunitec "E:\pieces\disk1.gsd" -o - > "D:\restored\film.mkv"
  • Nothing but the data goes to standard output. Every message, including the description of the set and the progress, goes to standard error.
  • Questions are answered as with -n: the run stops at the first problem.
  • If standard output is a console, gunitec refuses with the message "redirect it to a file or a pipe" and exits with code 1.
  • The checks run as usual. If the result differs from the original, the data has already been written when the exit code 5 comes back, so check the exit code before you use the data.
  • With -o -, no overwrite check, no pre-allocation and no restoration of dates is done, and nothing is deleted on failure.

Without a piece, gunitec looks for <its own name>.ini next to itself and runs the set that file describes, as the companion of a Self-Uniting app does. --ini <file> names the .ini explicitly. A piece together with --ini is a usage error (exit code 1).

In this mode -n never asks (the proposed folder is kept, an existing output is overwritten only with -y, otherwise the exit code is 4), -y answers the overwrite question yes when -n is also given, and --lang wins over the language set in the .ini. The format of the .ini is described in Self-Uniting companion .ini.

Without -n, gunitec asks when a problem comes up. An empty answer, or Q, stops the run.

ProblemAnswers
A piece is missing or is not piece n of this setA folder or file path to take the piece from, S to skip it, Q to stop.
A piece is shorter than announcedC continues with what was read, Q stops.
A piece is damaged (CRC mismatch)C continues anyway, Q stops.
Not enough space for the outputR retries after you free space, Q stops.
CodeMeaning
0Success: the set was joined or verified, or there was nothing to verify.
1Usage error: unknown option, no piece, bad buffer size, or -o - with a console as standard output.
2The set is not recognised or cannot be read. In Self-Uniting mode, the .ini cannot be read.
3The run stopped on a piece: missing, foreign, short or with a CRC error.
4Output problem: not writable, already exists (without -y), or no space.
5The run finished but the result does not match the original. The output is kept.
6Aborted, or cancelled before anything was written.
7Any other error.
Back to top

Screenshot