Command line: gunitec
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 --helpgunitec --version<piece> is any piece of the set. A set is joined from its first piece, which gunitec finds on its own.
Options
Section titled “Options”| Option | Meaning |
|---|---|
-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. |
-v | Verify 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. |
-y | Overwrite an existing output file. |
-k | Skip bad pieces (wrong set, short, CRC error) without asking. The output is then incomplete. |
-n | Non-interactive: never ask, stop at the first problem. |
-i | Inspect only: print the set and exit. |
-q | Quiet: no progress and no log. Errors still go to standard error. |
--no-sha | Do 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. |
--version | Print 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.
Inspect a set
Section titled “Inspect a set”-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.
gunitec "E:\pieces\disk1.gsd" -igunitec /mnt/usb/pieces/disk1.gsd -iVerify without writing
Section titled “Verify without writing”-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.
gunitec "E:\pieces\disk1.gsd" -v -nif errorlevel 1 echo The set is damaged or incomplete (code %errorlevel%)gunitec /mnt/usb/pieces/disk1.gsd -v -n || echo "The set is damaged or incomplete (code $?)"Join a set
Section titled “Join a set”gunitec "E:\pieces\disk1.gsd" -o "D:\restored\film.mkv"gunitec "E:\pieces\disk1.gsd" -o "D:\restored\film.mkv" -y -ngunitec /mnt/usb/pieces/disk1.gsd -o ~/restored/film.mkvgunitec /mnt/usb/pieces/disk1.gsd -o ~/restored/film.mkv -y -nGSplit 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:
gunitec "E:\pieces\report.pdf.001" -c "E:\pieces\report.pdf.crc" -o "D:\restored\report.pdf"Write to standard output
Section titled “Write to standard output”-o - sends the joined file to standard output, so it can go into a pipe without a temporary file.
gunitec "E:\pieces\disk1.gsd" -o - > "D:\restored\film.mkv"gunitec /mnt/usb/pieces/disk1.gsd -o - | tar -xf -- 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,
gunitecrefuses 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.
Self-Uniting mode
Section titled “Self-Uniting mode”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.
Questions
Section titled “Questions”Without -n, gunitec asks when a problem comes up. An empty answer, or Q, stops the run.
| Problem | Answers |
|---|---|
| A piece is missing or is not piece n of this set | A folder or file path to take the piece from, S to skip it, Q to stop. |
| A piece is shorter than announced | C continues with what was read, Q stops. |
| A piece is damaged (CRC mismatch) | C continues anyway, Q stops. |
| Not enough space for the output | R retries after you free space, Q stops. |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Success: the set was joined or verified, or there was nothing to verify. |
1 | Usage error: unknown option, no piece, bad buffer size, or -o - with a console as standard output. |
2 | The set is not recognised or cannot be read. In Self-Uniting mode, the .ini cannot be read. |
3 | The run stopped on a piece: missing, foreign, short or with a CRC error. |
4 | Output problem: not writable, already exists (without -y), or no space. |
5 | The run finished but the result does not match the original. The output is kept. |
6 | Aborted, or cancelled before anything was written. |
7 | Any other error. |
