Command line

Fixing “xdelta3: too many filenames”

This is a command-line error, not a patch problem. xdelta3 accepts at most two file names after its options. When a path contains spaces and isn’t quoted, the shell splits it into several words and xdelta3 sees too many.

  • Updated
  • Checked against Delta Patcher 3.1.6
  • 2 min read
  • Verified against primary sources · how we check

In short

  • xdelta3 takes options, then at most two file names (input and output). The source goes after -s.
  • A path with spaces and no quotes becomes several arguments, which triggers too many filenames.
  • Put every path in double quotes, or rename files to remove spaces.
  • Prefer not to use a terminal? Delta Patcher or the online patcher avoid the problem entirely.

What the error looks like

Terminal
xdelta3 -d -s Game (USA).iso translation.xdelta Game (USA) patched.iso
xdelta3: too many filenames: Game ...

The message quotes the first extra argument. Here -s took only Game as the source, so (USA).iso and translation.xdelta became the two file names, and the next word, Game, was one too many.

Why it happens

In xdelta3’s argument parser, after the options are read, “there may be up to two more arguments”: the input and the output file. Anything beyond that stops the program with too many filenames. The source file isn’t one of those two; it’s the value of -s. Your shell splits unquoted text at spaces, so Game (USA).iso arrives as two arguments, Game and (USA).iso.

The fix: quote every path

Windows, macOS and Linux
xdelta3 -d -s "Game (USA).iso" "translation.xdelta" "Game (USA) patched.iso"

Double quotes work in Command Prompt, PowerShell, bash and zsh. The general shape is:

Apply a patch
xdelta3 -d -s "original file" "patch.xdelta" "output file"
Create a patch
xdelta3 -e -s "original file" "modified file" "patch.xdelta"

Other ways to hit it

  • A leftover word from a copied command. Readmes sometimes include a placeholder like [output] that isn’t meant to be typed literally.
  • An option without its dash. Typing s instead of -s turns the option into a file name.
  • Batch files (.bat) that use %1 without quotes break when you drag in a file whose path has spaces. Change %1 to "%~1".

Skip the command line

Delta Patcher has xdelta3 built in and takes files by drag and drop, so quoting never comes up. The online patcher does the same in a browser. For scripted or batch use, the Linux guide covers the xdelta3 command line in detail.

Continue learning

Sources and references