Skip to content

Commit f9b23ca

Browse files
Merge pull request #9061 from ThomasWaldmann/document-extract-wildcard-1.4
extract: document how to use wildcards in PATHs
2 parents 924d94b + 908c506 commit f9b23ca

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

docs/usage/extract.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ Examples
1919
# Extract the "src" directory but exclude object files
2020
$ borg extract /path/to/repo::my-files home/USERNAME/src --exclude '*.o'
2121

22+
# Extract only the C files
23+
$ borg extract /path/to/repo::my-files 'sh:home/USERNAME/src/*.c'
24+
2225
# Restore a raw device (must not be active/in use/mounted at that time)
2326
$ borg extract --stdout /path/to/repo::my-sdx | dd of=/dev/sdx bs=10M

src/borg/archiver.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4371,11 +4371,15 @@ def diff_sort_spec_validator(s):
43714371

43724372
# borg extract
43734373
extract_epilog = process_epilog("""
4374-
This command extracts the contents of an archive. By default the entire
4375-
archive is extracted but a subset of files and directories can be selected
4376-
by passing a list of ``PATHs`` as arguments. The file selection can further
4377-
be restricted by using the ``--exclude`` option.
4374+
This command extracts the contents of an archive.
43784375
4376+
By default, the entire archive is extracted, but a subset of files and directories
4377+
can be selected by passing a list of ``PATH`` arguments. The default interpretation
4378+
for the paths to extract is `pp:` which is a literal path-prefix match. If you want
4379+
to use e.g. a wildcard, you must select a different pattern style such as `sh:` or
4380+
`fm:`. See :ref:`borg_patterns` for more information.
4381+
4382+
The file selection can be further restricted by using the ``--exclude`` option.
43794383
For more help on include/exclude patterns, see the :ref:`borg_patterns` command output.
43804384
43814385
By using ``--dry-run``, you can do all extraction steps except actually writing the

0 commit comments

Comments
 (0)