Borg: Having direct access to the latest backup (of an optional prefix)

Created on 1 Aug 2015  路  10Comments  路  Source: borgbackup/borg

I would love to have the possibility to directly refer to the latest backup like in "bup" where you can access the latest one by specifying "latest" as location.

Currently I use something list this:

borg list vps-borg:mt02-df-dbs.borg::$(borg list vps-borg:mt02-df-dbs.borg | tail -1 | awk '{ print $1 }')

With that change this would be:

borg list vps-borg:mt02-df-dbs.borg::latest

Of course latest could than not be an archive name anymore.

I would like if this also would support --prefix definitions and use the latest backup of an archive with that prefix.

P.S.: I know that all of this could be done with scripting. But that would be harder to handle all kinds of possible errors.

enhancement

Most helpful comment

Therefore, I understand the way to proceed is the following and there is no other functionality being developed:

borg list myrepo::$(borg list --last 1 myrepo)

All 10 comments

how about repo::prefix[idx] and using python index semantics on a sorted list of archives with the given prefix:
0 <= idx < n: the archive at position idx
-n <= idx <= -1: the archive at the -idx-last position

"latest" would be repo::prefix[-1].

or we reverse sort order, then "latest" is repo::prefix[0].

If we would like to use [n] index syntax, we would have to disallow [] as archive name characters.

Problem: may conflict with (currently) valid archive names.

We could use these without reserving new characters:

repo::prefix:0 => the latest with prefix 'prefix'
repo::prefix:1 => the next one
repo:::0       => the latest in the whole repo

EDIT: Or just repo:::latest

how about a more explicit addressing mode

if repository, name to match and indexing are separate arguments then the whole thing is trivial and non-ambigious

@Ape good idea, ":" is maybe reserved already.

@RonnyPfannschmidt see #948.

good idea, ":" is maybe reserved already.

Nope. Even :: is okay in archive names, some_archive:asd::def:::foo::::bar is a valid archive name.

I think the syntax should be more like:
borg list repo -P prefix --index -1
(Because borg list repo::archivename already exists, and not using [] allows these in the prefix name.)

Recently, --first / --last / --sort / --prefix was made available to some commands.

Therefore, I understand the way to proceed is the following and there is no other functionality being developed:

borg list myrepo::$(borg list --last 1 myrepo)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pierreozoux picture pierreozoux  路  4Comments

chebee7i picture chebee7i  路  5Comments

russelldavis picture russelldavis  路  3Comments

ThomasWaldmann picture ThomasWaldmann  路  6Comments

rugk picture rugk  路  3Comments