[Borgbackup] borg create is not accepting PATH with SPACE in it
Marian Beermann
public at enkore.de
Mon Mar 16 03:29:07 EDT 2020
Hi,
you will have to understand shell. This is not a Borg problem; it's a
shell problem.
> Even if I try to pass a single path (instead of a *cat* command) after
> REPO::ARCHIVE with space in it it fails.
In this case you will need quotes or escaping, e.g.
borg create ... "$HOME/My Documents"
(~ is not expanded by shells inside quotes, but variables are)
borg create ... '/home/amar/My Documents'
(No variables are expanded by shells inside single quotes)
borg create ... /home/amar/My\ Documents
Either of these three pass the same path to borg.
Now for the file problem.
The tl;dr is you don't want to do this yourself and this is the exact
reason Borg has --pattern-from and other applications things like @file
to read args from a file.
Without extra processing there is no way to pass the contents of a file
as multiple command arguments if you need escaping.
However, there is a standard utility that can be made to do this for
you. It's not really meant for this particular use case, but it'll work.
xargs borg create ... < $BORG_INCLUDE_FILE
The format of BORG_INCLUDE_FILE has to look like this:
'/home/amar/My Documents'
'/home/amar/My Pictures'
etc.
(If you add too many files to the list, xargs will start to run multiple
borg processes, which will cause errors or multiple archives containing
subsets)
-Marian
More information about the Borgbackup
mailing list