borg-find(1)
π borg-find(1) β find files across archives π
okay bestie, this is the manual page for borg-find, one of the commands in the borg backup tool. Sit down, get comfy, we're gonna find literally every file. π¦
β¨ NAME β¨
borg-find β find files across archives, fr fr.
πΈ SYNOPSIS πΈ
borg [common options] find [options] [PATH...]
π DESCRIPTION π
So what this command does is it finds files matching the paths or patterns you give it, inside the archives that got picked by the usual archive filter options (and if you gave no filters at all, bestie, it's all archives, no cap). It iterates over the matching archives from newest to oldest, goes over all items of each archive, and outputs one line per match β kinda like borg list, except each line is prefixed with a short archive ID and the archive name. And here's the tea: the archives of a series all share the same name, so only the archive ID uniquely identifies the archive. π
This makes it super easy to answer questions like "which archives contain this file?" or "where did that file end up?" β the way that this just works is iconic:
$ borg find home/user/file.txt # in which archives is this file?
$ borg find 'sh:**/*.jpg' --last 3 # all jpg files in the last 3 archives
The PATHs you pass match like in borg list or borg extract: a plain path matches the item with that path as well as everything below it, and the pattern styles (fm:, sh:, re:, pp:, pf:) are supported too. For more help on include/exclude patterns, go look at the output of borg_patterns.
Note: there is no extra index for the file paths, so this command reads the metadata of all selected archives, which may take a while for many/big archives. π Not me waiting on a huge backup... but that's the trade-off, bestie.
π OPTIONS π
See borg-common(1) for common options of Borg commands.
arguments
PATHβ paths to find; patterns are supported π«
options
--format FORMATβ specify format for file listing (default:"{archiveid:.8} {archivename} {mode} {user:6} {group:6} {size:8} {mtime} {path}{extra}{NL}")--json-linesβ Format output as JSON Lines. The form of--formatis ignored, but keys used in it are added to the JSON output. Some keys are always present. Note: JSON can only represent text.
Archive filters
-a PATTERN,--match-archives PATTERNβ only consider archives matching all patterns. Seeborg help match-archives.--sort-by KEYSβ Comma-separated list of sorting keys; valid keys are:timestamp,archive,name,id,tags,host,user; default is:timestamp--first Nβ consider the first N archives after other filters are applied--last Nβ consider the last N archives after other filters are applied--oldest TIMESPANβ consider archives between the oldest archive's timestamp and (oldest + TIMESPAN), e.g.,7dor12m.--newest TIMESPANβ consider archives between the newest archive's timestamp and (newest - TIMESPAN), e.g.,7dor12m.--older TIMESPANβ consider archives older than (now - TIMESPAN), e.g.,7dor12m.--newer TIMESPANβ consider archives newer than (now - TIMESPAN), e.g.,7dor12m.
Include/Exclude options
-e PATTERN,--exclude PATTERNβ exclude paths matching PATTERN--exclude-from EXCLUDEFILEβ read exclude patterns from EXCLUDEFILE, one per line--pattern PATTERNβ include/exclude paths matching PATTERN--patterns-from PATTERNFILEβ read include/exclude patterns from PATTERNFILE, one per line
π₯ EXAMPLES π₯
# In which archives is this file? Searched / printed from newest to oldest archive.
$ borg find home/user/file.txt
41a2ed21 docs -rw-rw-r-- user user 1522 Sun, 2022-02-06 21:02:18 +0100 home/user/file.txt
20e70e3a docs -rw-rw-r-- user user 1440 Sun, 2022-01-30 20:47:32 +0100 home/user/file.txt
# Find all jpg files in the last 3 archives.
$ borg find 'sh:**/*.jpg' --last 3
39c8956e photos -rw-rw-r-- user user 919337 Sat, 2022-01-01 14:20:21 +0100 photos/paris/eiffel.jpg
39c8956e photos -rw-rw-r-- user user 1023881 Sun, 2022-02-06 09:12:44 +0100 photos/rome/colosseum.jpg
04061a53 photos -rw-rw-r-- user user 919337 Sat, 2022-01-01 14:20:21 +0100 photos/paris/eiffel.jpg
# Only print the archive and the path, nothing else.
$ borg find --format '{archiveid:.8} {archivename} {path}{NL}' home/user/file.txt
41a2ed21 docs home/user/file.txt
20e70e3a docs home/user/file.txt
π§ NOTES π§
The FORMAT specifier syntax
The --format option uses Python's format string syntax https://docs.python.org/3.11/library/string.html#formatstrings.
Examples:
# only print the archive and the path, nothing else
$ borg find --format '{archiveid:.8} {archivename} {path}{NL}' 'sh:**/*.jpg'
20e70e3a photos photos/paris/eiffel.jpg
...
{archiveid:.8} prints a short archive ID (use {archiveid} for the full ID), {archivename} the archive name (the archives of a series all share the name).
The following keys are always available:
NEWLINE: OS dependent line separatorNL: alias ofNEWLINENUL: NUL character for creating print0 / xargs -0 like outputSPACE: space characterTAB: tab characterCR: carriage return characterLF: line feed character
Keys available only when finding files in an archive:
type: file type (file,dir,symlink, ...)mode: file mode (as in stat)uid: user id of file ownergid: group id of file owneruser: user name of file ownergroup: group name of file ownerpath: file pathtarget: link target for symlinkshlid: hard link identity (same if hardlinking same fs object)inode: inode numberflags: file flagssize: file sizenum_chunks: number of chunks in this filemtime: file modification timectime: file change timeatime: file access timeisomtime: file modification time (ISO 8601 format)isoctime: file change time (ISO 8601 format)isoatime: file access time (ISO 8601 format)fingerprint: Fingerprint of the file content (may have false negatives), format:H(conditions)-H(chunk_ids)blake2bblake2sblake3md5sha1sha224sha256sha384sha3_224sha3_256sha3_384sha3_512sha512archiveid: internal ID of the archivearchivename: name of the archiveextra: prepends{target}with" -> "for soft links and" link to "for hard links
π SEE ALSO π
π AUTHOR π
The Borg Collective
and that's the whole page, bestie!! π«Ά this version of the borg-find(1) page is dated 2026-10-07, and yes it's still literally borg-find(1). go forth and find ur files. periodt. πβ¨
π¦ where this page comes from
- ubuntu stonking: borgbackup2 2.0.0b25-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms