dar-backup 0.6.20__py3-none-any.whl → 0.6.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dar_backup/README.md CHANGED
@@ -1,14 +1,18 @@
1
1
  <!-- markdownlint-disable MD024 -->
2
- # Full, differential or incremental backups using 'dar'
2
+ # `dar-backup`
3
+
4
+ **Reliable DAR backups, automated in clean Python**
3
5
 
4
6
  [![codecov](https://codecov.io/gh/per2jensen/dar-backup/branch/main/graph/badge.svg)](https://codecov.io/gh/per2jensen/dar-backup)
7
+ ![CI](https://github.com/per2jensen/dar-backup/actions/workflows/py-tests.yml/badge.svg)
8
+ [![PyPI version](https://img.shields.io/pypi/v/dar-backup.svg)](https://pypi.org/project/dar-backup/)
5
9
  [![PyPI monthly downloads](https://img.shields.io/pypi/dm/dar-backup)](https://pypi.org/project/dar-backup/)
6
10
  [![Total Downloads](https://img.shields.io/badge/dynamic/json?color=blue&label=Total%20Downloads&query=total&url=https%3A%2F%2Fraw.githubusercontent.com%2Fper2jensen%2Fdar-backup%2Fmain%2Fdownloads.json)](https://pypi.org/project/dar-backup/)
7
11
 
8
12
  The wonderful 'dar' [Disk Archiver](https://github.com/Edrusb/DAR) is used for
9
- the heavy lifting, together with the par2 suite in these scripts.
13
+ the heavy lifting, together with the [parchive](https://github.com/Parchive/par2cmdline) suite in these scripts.
10
14
 
11
- This is the `Python` based **version 2** of `dar-backup`.
15
+ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-backup/tree/main/v2) of `dar-backup`.
12
16
 
13
17
  ## TL;DR
14
18
 
@@ -16,13 +20,15 @@ This is the `Python` based **version 2** of `dar-backup`.
16
20
 
17
21
  ## Table of Contents
18
22
 
19
- - [Full, differential or incremental backups using 'dar'](#full-differential-or-incremental-backups-using-dar)
23
+ - [Reliable `dar` backups wrapped in Python](#dar-backup)
20
24
  - [My use case](#my-use-case)
21
25
  - [License](#license)
26
+ - [Changelog version 2](https://github.com/per2jensen/dar-backup/blob/main/v2/Changelog.md)
22
27
  - [Status](#status)
23
28
  - [GPG Signing key](#gpg-signing-key)
24
29
  - [Breaking change in version 0.6.0](#breaking-change-in-version-060)
25
30
  - [Homepage - Github](#homepage---github)
31
+ - [Community](#community)
26
32
  - [Requirements](#requirements)
27
33
  - [Principles](#dar-backup-principles)
28
34
  - [How to run](#how-to-run)
@@ -43,8 +49,7 @@ This is the `Python` based **version 2** of `dar-backup`.
43
49
  - [List contents of an archive](#list-contents-of-an-archive)
44
50
  - [dar file selection examples](#dar-file-selection-examples)
45
51
  - [Select a directory](#select-a-directory)
46
- - [Select file dates in the directory](#select-file-dates-in-the-directory)
47
- - [Exclude .xmp files from that date](#exclude-xmp-files-from-that-date)
52
+ - [Include and exclude some file](#select-files-with-z50-in-the-file-name-and-exclude-xmp-files)
48
53
  - [Restoring](#restoring)
49
54
  - [Default location for restores](#default-location-for-restores)
50
55
  - [--restore-dir option](#--restore-dir-option)
@@ -64,6 +69,7 @@ This is the `Python` based **version 2** of `dar-backup`.
64
69
  - [Separate log file for command output](#separate-log-file-for-command-output)
65
70
  - [Skipping cache directories](#skipping-cache-directories)
66
71
  - [Progress bar + current directory](#progress-bar-and-current-directory)
72
+ - [Shell Autocompletion](#shell-autocompletion)
67
73
  - [Todo](#todo)
68
74
  - [Known Limitations / Edge Cases](#known-limitations--edge-cases)
69
75
  - [Reference](#reference)
@@ -73,8 +79,9 @@ This is the `Python` based **version 2** of `dar-backup`.
73
79
  - [manager](#manager-options)
74
80
  - [cleanup](#cleanup-options)
75
81
  - [clean-log](#clean-log-options)
76
- - [installer](#installer-options)
77
82
  - [dar-backup-systemd](#dar-backup-systemd)
83
+ - [Installer](#installer)
84
+ - [demo](#demo)
78
85
 
79
86
  ## My use case
80
87
 
@@ -87,7 +94,7 @@ I have cloud storage mounted on a directory within my home dir. The filesystem i
87
94
 
88
95
  - Backup my cloud storage to something local (cloud is convenient, but I want control over my backups)
89
96
  - Backup primarily photos, video and different types of documents
90
- - Have a simple non-complicated way of restoring, possibly years into the future. 'dar' fits that scenario with a single statically linked binary (kept with the archives). There is no need install/configure anything - restoring is simple and works well.
97
+ - Have a simple way of restoring, possibly years into the future. 'dar' fits that scenario with a single statically linked binary (kept with the archives). There is no need install/configure anything - restoring is simple and works well.
91
98
  - During backup archives must be tested and a restore test (however small) performed
92
99
  - Archives stored on a server with a reliable file system (easy to mount a directory over sshfs)
93
100
  - Easy to verify archive's integrity, after being moved around.
@@ -97,7 +104,7 @@ I have cloud storage mounted on a directory within my home dir. The filesystem i
97
104
  ## License
98
105
 
99
106
  These scripts are licensed under the GPLv3 license.
100
- Read more here: [GNU CPL 3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), or have a look at the ["LICENSE"](https://github.com/per2jensen/dar-backup/blob/main/LICENSE) file in this repository.
107
+ Read more here: [GNU GPL3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), or have a look at the ["LICENSE"](https://github.com/per2jensen/dar-backup/blob/main/LICENSE) file in this repository.
101
108
 
102
109
  ## Status
103
110
 
@@ -109,9 +116,13 @@ As of February 13, 2025, I have changed the status from alpha --> beta, as the f
109
116
 
110
117
  To increase the security and authenticity of dar-backup packages, all releases from v2-beta-0.6.18 onwards will be digitally signed using the GPG key below.
111
118
 
112
- 🔐 GPG Signing Key Details
119
+ <br>
120
+
121
+ <details>
122
+
123
+ <summary>🎯 GPG Signing Key Details</summary>
113
124
 
114
- ```` text
125
+ ```text
115
126
  Name: Per Jensen (author of dar-backup)
116
127
  Email: dar-backup@pm.me
117
128
  Primary key: 4592 D739 6DBA EFFD 0845 02B8 5CCE C7E1 6814 A36E
@@ -120,9 +131,13 @@ Created: 2025-03-29
120
131
  Expires: 2030-03-28
121
132
  Key type: ed25519 (primary, SC)
122
133
  Subkeys: ed25519 (S), ed25519 (A), cv25519 (E)
123
- ````
134
+ ```
135
+
136
+ <br>
124
137
 
125
- 🔏 Where to Find Release Signatures
138
+ <details>
139
+
140
+ <summary>🎯 Where to Find Release Signatures</summary>
126
141
 
127
142
  PyPI does *Not* host .asc Signature Files
128
143
 
@@ -130,7 +145,7 @@ Although the `dar-backup` packages on PyPI are GPG-signed, PyPI itself does **no
130
145
 
131
146
  Therefore, you will not find `.asc` files on PyPI.
132
147
 
133
- Where to Get `.asc` Signature Files
148
+ **Where to Get `.asc` Signature Files**
134
149
 
135
150
  You can always download the signed release artifacts and their `.asc` files from the official GitHub Releases page:
136
151
 
@@ -146,43 +161,55 @@ Each release includes:
146
161
 
147
162
  - `dar_backup-x.y.z-py3-none-any.whl.asc`
148
163
 
149
- 🔐 How to Verify a Release from GitHub
164
+ </details>
165
+
166
+ <br>
167
+
168
+ <details>
169
+
170
+ <summary>🎯 How to Verify a Release from GitHub</summary>
150
171
 
151
172
  1. Import the GPG public key:
152
173
 
153
- ```` bash
174
+ ```bash
154
175
  curl https://keys.openpgp.org/vks/v1/by-fingerprint/4592D7396DBAEFFD084502B85CCEC7E16814A36E | gpg --import
155
- ````
176
+ ```
156
177
 
157
178
  2. Download the wheel or tarball and its .asc signature from the GitHub.
158
179
 
159
180
  3. Run GPG to verify it:
160
181
 
161
- ```` bash
182
+ ```bash
162
183
  gpg --verify dar_backup-x.y.z.tar.gz.asc dar_backup-x.y.z.tar.gz
163
184
  # or
164
185
  gpg --verify dar_backup-x.y.z-py3-none-any.whl.asc dar_backup-x.y.z-py3-none-any.whl
165
- ````
186
+ ```
166
187
 
167
188
  4. If the signature is valid, you'll see:
168
189
 
169
- ```` text
190
+ ```text
170
191
  gpg: Good signature from "Per Jensen (author of dar-backup) <dar-backup@pm.me>"
171
- ````
192
+ ```
172
193
 
173
194
  🛡️ Reminder: Verify the signing subkey
174
195
 
175
196
  Only this subkey is used to sign PyPI packages:
176
197
 
177
- ```` text
198
+ ```text
178
199
  B54F 5682 F28D BA36 22D7 8E04 58DB FADB BBAC 1BB1
179
- ````
200
+ ```
180
201
 
181
202
  You can view it with:
182
203
 
183
- ```` bash
204
+ ```bash
184
205
  gpg --list-keys --with-subkey-fingerprints dar-backup@pm.me
185
- ````
206
+ ```
207
+
208
+ </details>
209
+
210
+ </details>
211
+
212
+ <br>
186
213
 
187
214
  ### Breaking change in version 0.6.0
188
215
 
@@ -194,17 +221,22 @@ Version 0.6.0 and forwards requires the config variable *COMMAND_TIMEOUT_SECS* i
194
221
 
195
222
  This python version is v2 of dar-backup, v1 is made in bash.
196
223
 
224
+ ## Community
225
+
226
+ Please review the [Code of Conduct](https://github.com/per2jensen/dar-backup/blob/main/CODE_OF_CONDUCT.md) to help keep this project welcoming and focused.
227
+
197
228
  ## Requirements
198
229
 
199
230
  - dar
200
231
  - par2
201
232
  - python3
233
+ - python3-venv
202
234
 
203
235
  On Ubuntu, install the requirements this way:
204
236
 
205
- ```` bash
206
- sudo apt install dar par2 python3
207
- ````
237
+ ```bash
238
+ sudo apt install dar par2 python3 python3-venv
239
+ ```
208
240
 
209
241
  ## dar-backup principles
210
242
 
@@ -255,7 +287,9 @@ Installation is currently in a venv. These commands are installed in the venv:
255
287
  - cleanup
256
288
  - manager
257
289
  - clean-log
290
+ - dar-backup-systemd
258
291
  - installer
292
+ - demo
259
293
 
260
294
  Note:
261
295
 
@@ -263,44 +297,53 @@ The module `inputimeout` is installed into the venv and used for the confirmatio
263
297
 
264
298
  To install, create a venv and run pip:
265
299
 
266
- ```` bash
300
+ ```bash
267
301
  mkdir $HOME/tmp
268
302
  cd $HOME/tmp
269
303
  python3 -m venv venv # create the virtual environment
270
304
  . venv/bin/activate # activate the virtual env
271
305
  pip install dar-backup # run pip to install `dar-backup`
272
- ````
306
+ ```
273
307
 
274
308
  I have an alias in ~/.bashrc pointing to my venv:
275
309
 
276
- ```` bash
310
+ ```bash
277
311
  alias db=". ~/tmp/venv/bin/activate; dar-backup -v"
278
- ````
312
+ ```
279
313
 
280
- Typing `db` at the command line gives this
314
+ drop the alias into ~/.bashrc like this:
281
315
 
282
- ```` bash
316
+ ```bash
317
+ grep -qxF 'alias db=". ~/tmp/venv/bin/activate; dar-backup -v"' ~/.bashrc \
318
+ || echo 'alias db=". ~/tmp/venv/bin/activate; dar-backup -v"' >> ~/.bashrc
319
+
320
+ source ~/.bashrc
321
+ ```
322
+
323
+ Typing `db` at the command line gives something like this:
324
+
325
+ ```bash
283
326
  (venv) user@machine:~$ db
284
327
  dar-backup 0.6.12
285
328
  dar-backup.py source code is here: https://github.com/per2jensen/dar-backup
286
329
  Licensed under GNU GENERAL PUBLIC LICENSE v3, see the supplied file "LICENSE" for details.
287
330
  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
288
331
  See section 15 and section 16 in the supplied "LICENSE" file.
289
- ````
332
+ ```
290
333
 
291
334
  ### 2 - configuration
292
335
 
293
- The dar-backup installer is non-destructive and stops if some of the default directories exist.
336
+ The dar-backup `demo` is non-destructive and stops if some of the default directories exist.
294
337
 
295
- Run the installer
338
+ Run `demo`
296
339
 
297
- ```` bash
298
- installer --install
299
- ````
340
+ ```bash
341
+ demo --install
342
+ ```
300
343
 
301
344
  The output is
302
345
 
303
- ```` text
346
+ ```text
304
347
  Directories created: `/home/user/dar-backup/` and `/home/user/.config/dar-backup`
305
348
  Config file deployed to /home/user/.config/dar-backup/dar-backup.conf
306
349
  Default backup definition deployed to /home/user/.config/dar-backup/backup.d/default
@@ -308,7 +351,7 @@ Default backup definition deployed to /home/user/.config/dar-backup/backup.d/def
308
351
  2. Then you can run `dar-backup --full-backup` to create a backup.
309
352
  3. List backups with `dar-backup --list`
310
353
  4. List contents of a backup with `dar-backup --list-contents <backup-name>`
311
- ````
354
+ ```
312
355
 
313
356
  ### 3 - generate catalog databases
314
357
 
@@ -316,9 +359,9 @@ Generate the archive catalog database(s).
316
359
 
317
360
  `dar-backup` expects the catalog databases to be in place, it does not automatically create them (by design)
318
361
 
319
- ```` bash
362
+ ```bash
320
363
  manager --create-db
321
- ````
364
+ ```
322
365
 
323
366
  ### 4 - do FULL backups
324
367
 
@@ -327,9 +370,9 @@ Prereq:
327
370
 
328
371
  You are ready to do backups of all your backup definitions.
329
372
 
330
- ```` bash
373
+ ```bash
331
374
  dar-backup --full-backup
332
- ````
375
+ ```
333
376
 
334
377
  If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option. This can be useful if dar-backup is started by systemd.
335
378
 
@@ -337,17 +380,17 @@ If you want more log messages, use the `--verbose` or `--log-level debug` for ev
337
380
 
338
381
  If you want a backup of a single definition, use the `-d <backup definition>` option. The definition's name is the filename of the definition in the `backup.d` config directory.
339
382
 
340
- ```` bash
383
+ ```bash
341
384
  dar-backup --full-backup -d <your backup definition>
342
- ````
385
+ ```
343
386
 
344
387
  ### 5 - deactivate venv
345
388
 
346
389
  Deactivate the virtual environment (venv)
347
390
 
348
- ```` bash
391
+ ```bash
349
392
  deactivate
350
- ````
393
+ ```
351
394
 
352
395
  ## Config
353
396
 
@@ -359,7 +402,7 @@ If you have your config file somewhere else, use the `--config` option to point
359
402
 
360
403
  Tilde `~` and environment variables can be used in the paths for various file locations.
361
404
 
362
- ```` code
405
+ ```text
363
406
  [MISC]
364
407
  LOGFILE_LOCATION=~/.dar-backup.log
365
408
  MAX_SIZE_VERIFICATION_MB = 20
@@ -374,6 +417,9 @@ COMMAND_TIMEOUT_SECS = 86400
374
417
  BACKUP_DIR = /some/where/dar-backup/backups/
375
418
  BACKUP.D_DIR = /some/where/dar-backup/backup.d
376
419
  TEST_RESTORE_DIR = /tmp/dar-backup/restore/
420
+ # Optional parameter
421
+ # If you want to store the catalog databases away from the BACKUP_DIR, use the MANAGER_DB_DIR variable.
422
+ #MANAGER_DB_DIR = /some/where/else/
377
423
 
378
424
  [AGE]
379
425
  # age settings are in days
@@ -392,7 +438,7 @@ SCRIPT_1 = ls -l /tmp
392
438
  [POSTREQ]
393
439
  SCRIPT_1 = df -h
394
440
  #SCRIPT_2 = another_script.sh
395
- ````
441
+ ```
396
442
 
397
443
  ### .darrc
398
444
 
@@ -402,7 +448,7 @@ You can override the default `.darrc` using the `--darrc` option.
402
448
 
403
449
  The default `.darrc` contents are as follows:
404
450
 
405
- ```` code
451
+ ```text
406
452
  # .darrc configuration file for `dar` as used by the `dar-backup` script.
407
453
  # `dar-backup` lives here: https://github.com/per2jensen/dar-backup
408
454
 
@@ -523,7 +569,7 @@ compress-exclusion:
523
569
  # Now we swap back to case sensitive mode for masks which is the default
524
570
  #mode:
525
571
  -acase
526
- ````
572
+ ```
527
573
 
528
574
  ### Backup definition example
529
575
 
@@ -532,7 +578,7 @@ The name of the file is the name of the backup definition.
532
578
 
533
579
  You can use as many backup definitions as you need.
534
580
 
535
- ```` code
581
+ ```text
536
582
  # Switch to ordered selection mode, which means that the following
537
583
  # options will be considered top to bottom
538
584
  -am
@@ -566,7 +612,7 @@ You can use as many backup definitions as you need.
566
612
  # http://dar.linux.free.fr/doc/Features.html
567
613
  # https://bford.info/cachedir/
568
614
  --cache-directory-tagging
569
- ````
615
+ ```
570
616
 
571
617
  ## Generate systemd files
572
618
 
@@ -576,7 +622,7 @@ The timers are set as the author uses them, modify to your taste and needs.
576
622
 
577
623
  Example run:
578
624
 
579
- ```` bash
625
+ ```bash
580
626
  dar-backup-systemd --venv /home/user/tmp/venv --dar-path /home/user/.local/dar/bin
581
627
  Generated dar-full-backup.service and dar-full-backup.timer
582
628
  → Fires on: *-12-30 10:03:00
@@ -586,7 +632,7 @@ Generated dar-incr-backup.service and dar-incr-backup.timer
586
632
  → Fires on: *-*-04/3 19:03:00
587
633
  Generated dar-clean.service and dar-clean.timer
588
634
  → Fires on: *-*-* 21:07:00
589
- ````
635
+ ```
590
636
 
591
637
  ## Systemctl examples
592
638
 
@@ -604,17 +650,17 @@ systemctl --user daemon-reload
604
650
 
605
651
  Verify your timers are set up as you want:
606
652
 
607
- ```` bash
653
+ ```bash
608
654
  systemctl --user list-timers
609
- ````
655
+ ```
610
656
 
611
657
  ## Service: dar-backup --incremental-backup
612
658
 
613
- This is an exmaple of a systemd user service unit.
659
+ This is an example of a systemd user service unit.
614
660
 
615
661
  File: dar-incr-backup.service
616
662
 
617
- ```` bash
663
+ ```bash
618
664
  /tmp/test$ dar-backup-systemd --venv '$HOME/programmer/dar-backup.py/venv' --dar-path '$HOME/.local/dar/bin'
619
665
 
620
666
  Generated dar-full-backup.service and dar-full-backup.timer
@@ -640,7 +686,7 @@ RemainAfterExit=no
640
686
 
641
687
 
642
688
  ExecStart=/bin/bash -c 'PATH=$HOME/.local/dar/bin:$PATH && . $HOME/programmer/dar-backup.py/venv/bin/activate && dar-backup -I --verbose --log-stdout'
643
- ````
689
+ ```
644
690
 
645
691
  ## Timer: dar-backup --incremental-backup
646
692
 
@@ -648,7 +694,7 @@ This is an example of a systemd user timer
648
694
 
649
695
  File: dar-incr-backup.timer
650
696
 
651
- ```` code
697
+ ```text
652
698
  [Unit]
653
699
  Description=dar-backup INCR timer
654
700
 
@@ -658,7 +704,7 @@ Persistent=true
658
704
 
659
705
  [Install]
660
706
  WantedBy=timers.target
661
- ````
707
+ ```
662
708
 
663
709
  ## systemd timer note
664
710
 
@@ -666,118 +712,94 @@ WantedBy=timers.target
666
712
 
667
713
  ## list contents of an archive
668
714
 
669
- ```` bash
670
- . <the virtual evn>/bin/activate
671
- dar-backup --list-contents example_FULL_2024-06-23 --selection "-X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play"
715
+ ```bash
716
+ # Activate your virtual environment
717
+ source <the virtual evn>/bin/activate
718
+ dar-backup --list-contents media-files_INCR_2025-05-10
719
+ # Deactivate when done
672
720
  deactivate
673
- ````
674
-
675
- gives
721
+ ```
676
722
 
677
- ``` code
678
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
679
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
680
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
681
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
682
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
683
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
684
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
723
+ gives something like
724
+
725
+ ```text
726
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 2 Gio Sat May 10 14:15:07 2025 home/pj
727
+ [Saved][ ] [-L-][ 93%][ ] -rw-rw-r-- pj pj 29 kio Fri May 9 16:45:38 2025 home/pj/data/2023/2023-02-11-Udstilling-Fredericia/DSC_0568.NEF.xmp
728
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 2 Gio Fri May 9 12:49:04 2025 home/pj/data/2025
729
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 193 Mio Thu May 8 15:59:17 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR
730
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 15 Mio Thu May 8 15:52:27 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0563.NEF
731
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 10 Mio Thu May 8 15:52:27 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0563.JPG
732
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 9 Mio Thu May 8 15:51:53 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0559.JPG
733
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 16 Mio Thu May 8 15:51:45 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.NEF
734
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 12 Mio Thu May 8 15:51:45 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.JPG
735
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 16 Mio Thu May 8 15:51:24 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.NEF
736
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 12 Mio Thu May 8 15:51:23 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.JPG
737
+ [Saved][ ] [-L-][ 91%][ ] -rw-rw-r-- pj pj 22 kio Thu May 8 15:59:58 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.JPG.xmp
738
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 30 kio Thu May 8 16:00:36 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.NEF.xmp
739
+ [Saved][ ] [-L-][ 91%][ ] -rw-rw-r-- pj pj 22 kio Thu May 8 16:00:29 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.JPG.xmp
685
740
  ```
686
741
 
687
742
  ## dar file selection examples
688
743
 
689
- ### select a directory
744
+ > ⚠️ **Quoting matters**
745
+ >
746
+ > Always pass `--selection` as `--selection="-I '*.NEF'"` to ensure it’s treated as a single argument.
747
+ >
748
+ > Avoid splitting `--selection` and the string into separate tokens.
690
749
 
691
- ``` bash
692
- dar -l /tmp/example_FULL_2024-06-23 -g home/pj/tmp/LUT-play
693
- ```
750
+ **Why does --selection give “expected one argument” error?**
694
751
 
695
- gives
752
+ This happens when the shell splits the quoted string or interprets globs before `dar-backup` sees them.
753
+ ✅ Use: `--selection="-I '*.NEF'"`
754
+ ❌ Avoid: `--selection "-I '*.NEF'"`
696
755
 
697
- ```` code
698
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
699
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
700
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
701
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
702
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
703
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
704
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
705
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 48 kio Sat Jun 22 21:51:24 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF.xmp
706
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 50 kio Sat Jun 22 21:51:25 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_01.NEF.xmp
707
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:26 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_02.NEF.xmp
708
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_03.NEF.xmp
709
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_04.NEF.xmp
710
- [Saved][ ] [-L-][ 97%][ ] -rw-rw-r-- pj pj 77 kio Sat Jun 22 21:50:16 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_05.NEF.xmp
711
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 52 kio Sat Jun 22 21:49:37 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_06.NEF.xmp
712
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:47 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_07.NEF.xmp
713
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_08.NEF.xmp
714
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_09.NEF.xmp
715
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:39 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_10.NEF.xmp
716
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:36 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_11.NEF.xmp
717
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:35 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_12.NEF.xmp
718
- [Saved][ ] [-L-][ 88%][ ] -rw-rw-r-- pj pj 15 kio Sat Jun 22 21:51:11 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_13.NEF.xmp
719
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 84 kio Sat Jun 22 21:51:09 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_14.NEF.xmp
720
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 90 kio Sat Jun 22 21:51:04 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_15.NEF.xmp
721
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:15 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_16.NEF.xmp
722
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:48 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_17.NEF.xmp
723
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:19 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_18.NEF.xmp
724
- ````
756
+ > 💡 **Tip:** See [dar's documentation](http://dar.linux.free.fr/doc/man/dar.html#COMMANDS%20AND%20OPTIONS)
757
+
758
+ ### select a directory
725
759
 
726
- ### select file dates in the directory
760
+ Select files and sub directories in `home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling`
727
761
 
728
- ``` bash
729
- dar -l /tmp/example_FULL_2024-06-23 -I '*2024-06-16*' -g home/pj/tmp/LUT-play
762
+ ```bash
763
+ dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-g 'home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling'"
730
764
  ```
731
765
 
732
766
  gives
733
767
 
734
- ``` code
735
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
736
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
737
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
738
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
739
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
740
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Sed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
741
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
742
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 48 kio Sat Jun 22 21:51:24 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF.xmp
743
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 50 kio Sat Jun 22 21:51:25 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_01.NEF.xmp
744
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:26 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_02.NEF.xmp
745
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_03.NEF.xmp
746
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_04.NEF.xmp
747
- [Saved][ ] [-L-][ 97%][ ] -rw-rw-r-- pj pj 77 kio Sat Jun 22 21:50:16 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_05.NEF.xmp
748
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 52 kio Sat Jun 22 21:49:37 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_06.NEF.xmp
749
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:47 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_07.NEF.xmp
750
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_08.NEF.xmp
751
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_09.NEF.xmp
752
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:39 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_10.NEF.xmp
753
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:36 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_11.NEF.xmp
754
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:35 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_12.NEF.xmp
755
- [Saved][ ] [-L-][ 88%][ ] -rw-rw-r-- pj pj 15 kio Sat Jun 22 21:51:11 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_13.NEF.xmp
756
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 84 kio Sat Jun 22 21:51:09 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_14.NEF.xmp
757
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 90 kio Sat Jun 22 21:51:04 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_15.NEF.xmp
758
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:15 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_16.NEF.xmp
759
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:48 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_17.NEF.xmp
760
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:19 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_18.NEF.xmp
768
+ ```text
769
+ ...
770
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 29 Mio Fri May 9 10:33:42 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0572.NEF
771
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 28 Mio Fri May 9 10:33:12 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0571.NEF
772
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 25 Mio Fri May 9 10:33:08 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0570.NEF
773
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 27 Mio Fri May 9 10:32:46 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0569.NEF
774
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 27 Mio Fri May 9 10:32:46 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0568.NEF
775
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 833 Mio Fri May 9 12:49:57 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg
776
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 11 Mio Fri May 9 10:32:45 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0568.JPG
777
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 11 Mio Fri May 9 10:32:46 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0569.JPG
778
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 9 Mio Fri May 9 10:33:08 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0570.JPG
779
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- pj pj 13 Mio Fri May 9 10:33:12 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0571.JPG
780
+ ...
761
781
  ```
762
782
 
763
- ### exclude .xmp files from that date
764
-
765
- ``` bash
766
- dar -l /tmp/example_FULL_2024-06-23 -X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play
783
+ ### select files with "Z50" in the file name and exclude .xmp files
767
784
 
785
+ ```bash
786
+ dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-I '*Z50*' -X '*.xmp'"
768
787
  ```
769
788
 
770
- gives
771
-
772
- ```` code
773
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
774
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
775
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
776
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 ome/pj
777
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 ome/pj/tmp
778
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 ` ome/pj/tmp/LUT-play
779
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 ` home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
780
- ````
789
+ gives something like
790
+
791
+ ```text
792
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 2 Gio Sat May 10 14:15:07 2025 home/pj
793
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 2 Gio Fri May 9 12:49:04 2025 home/pj/data/2025
794
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 193 Mio Thu May 8 15:59:17 2025 home/pj/data/2025/2025-05-09-Viltrox-25mm-AIR
795
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 2 Gio Fri May 9 16:47:37 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling
796
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 26 Mio Fri May 9 11:26:16 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0633.NEF
797
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 26 Mio Fri May 9 11:26:16 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0632.NEF
798
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 28 Mio Fri May 9 11:09:04 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0631.NEF
799
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 29 Mio Fri May 9 11:09:03 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0630.NEF
800
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 29 Mio Fri May 9 11:09:03 2025 home/pj/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0629.NEF
801
+ ...
802
+ ```
781
803
 
782
804
  ## Restoring
783
805
 
@@ -797,7 +819,7 @@ The directory supplied functions as the Root of the restore operation.
797
819
 
798
820
  A backup has been taken using this backup definition:
799
821
 
800
- ``` code
822
+ ```text
801
823
  -R /
802
824
  -g home/user/Documents
803
825
  ```
@@ -806,16 +828,15 @@ When restoring and using `/tmp` for --restore-dir, the restored files can be fou
806
828
 
807
829
  ### a single file
808
830
 
809
- ``` code
831
+ ```text
810
832
  . <the virtual env>/bin/activate
811
833
  dar-backup --restore <archive_name> --selection "-g path/to/file"
812
834
  deactivate
813
-
814
835
  ```
815
836
 
816
837
  ### a directory
817
838
 
818
- ``` bash
839
+ ```bash
819
840
  . <the virtual env>/bin/activate
820
841
  dar-backup --restore <archive_name> --selection "-g path/to/directory"
821
842
  deactivate
@@ -823,7 +844,7 @@ deactivate
823
844
 
824
845
  ### .NEF from a specific date
825
846
 
826
- ``` bash
847
+ ```bash
827
848
  . <the virtual env>/bin/activate
828
849
  dar-backup --restore <archive_name> --selection "-X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play"
829
850
  deactivate
@@ -831,9 +852,9 @@ deactivate
831
852
 
832
853
  ### restore test fails with exit code 4
833
854
 
834
- "dar" in newer versions emits a question about file ownership, which is "answered" with a "no" via the "-Q" option. That in turn leads to an error code 4.
855
+ `dar` in newer versions emits a question about file ownership, which is "answered" with a "no" via the "-Q" option. That in turn leads to an error code 4.
835
856
 
836
- Thus the dar option "--comparison-field=ignore-owner" has been placed in the supplied [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed).
857
+ Thus the dar option `--comparison-field=ignore-owner` has been placed in the supplied [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed).
837
858
 
838
859
  This causes dar to restore without an error.
839
860
 
@@ -846,7 +867,7 @@ If exit code 5 is emitted on the restore test, FSA (File System specific Attribu
846
867
  That (might) occur if you backup a file stored on one type of filesystem, and restore it on another type.
847
868
  My home directory is on a btrfs filesystem, while /tmp (for the restore test) is on zfs.
848
869
 
849
- The restore test can result in an exit code 5, due to the different filesystems used. In order to avoid the errors, the "option "--fsa-scope none" can be used. That will restult in FSA's not being restored.
870
+ The restore test can result in an exit code 5, due to the different filesystems used. In order to avoid the errors, the option `--fsa-scope none` can be used. That will restult in FSA's not being restored.
850
871
 
851
872
  If you need to use this option, un-comment it in the [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed)
852
873
 
@@ -856,28 +877,28 @@ If you need to use this option, un-comment it in the [.darrc](#darrc) file (loca
856
877
 
857
878
  You can run a par2 verification on an archive like this:
858
879
 
859
- ```` bash
880
+ ```bash
860
881
  for file in <archive>*.dar.par2; do
861
882
  par2 verify "$file"
862
883
  done
863
- ````
884
+ ```
864
885
 
865
886
  if there are problems with a slice, try to repair it like this:
866
887
 
867
- ```` bash
888
+ ```bash
868
889
  par2 repair <archive>.<slice number>.dar.par2
869
- ````
890
+ ```
870
891
 
871
892
  ### Par2 create redundancy files
872
893
 
873
894
  If you have merged archives, you will need to create the .par2 redundency files manually.
874
895
  Here is an example
875
896
 
876
- ```` bash
897
+ ```bash
877
898
  for file in <some-archive>_FULL_yyyy-mm-dd.*; do
878
899
  par2 c -r5 -n1 "$file"
879
900
  done
880
- ````
901
+ ```
881
902
 
882
903
  where "c" is create, -r5 is 5% redundency and -n1 is 1 redundency file
883
904
 
@@ -890,7 +911,7 @@ One way to do that, is to let dar create a FULL archive from scratch, another is
890
911
 
891
912
  I do backups of my homedir. Here it is shown how a FULL archive is merged with a DIFF, creating a new FULL archive.
892
913
 
893
- ```` bash
914
+ ```bash
894
915
  dar --merge pj-homedir_FULL_2021-09-12 -A pj-homedir_FULL_2021-06-06 -@pj-homedir_DIFF_2021-08-29 -s 12G
895
916
 
896
917
  # test the new FULL archive
@@ -900,8 +921,7 @@ dar -t pj-homedir_FULL_2021-09-12
900
921
  for file in pj-homedir_FULL_yyyy-mm-dd.*.dar; do
901
922
  par2 c -r5 -n1 "$file"
902
923
  done
903
-
904
- ````
924
+ ```
905
925
 
906
926
  ### dar manager databases
907
927
 
@@ -949,8 +969,144 @@ dar-backup displays 2 visual artifacts to show progress.
949
969
 
950
970
  The indicators are not shown if dar-backup is run from systemd or if it is used in terminal multiplexers like `tmux` or `screen`. So no polluting of journald logs.
951
971
 
972
+ ### Shell autocompletion
973
+
974
+ The `dar-backup`, `manager`, and `cleanup` scripts now support dynamic Bash tab-completion, making them easier and faster to use.
975
+
976
+ ✅ Features
977
+
978
+ - Autocomplete for all long options (--config-file, --restore, etc.)
979
+
980
+ - Dynamic suggestions based on your config:
981
+
982
+ - --backup-definition shows available definitions from backup.d/
983
+
984
+ - show relevant archives when a backup definition has been chosen:
985
+
986
+ dar-backup: --restore, --list-contents, and --alternate-reference-archive
987
+
988
+ cleanup: --cleanup-specific-archives
989
+
990
+ manager: --list-archive-contents, --add-specific-archive (autocomplete those **not* in the catalog database), --remove-specific-archive
991
+
992
+ - Supports paths like ~ and $HOME correctly
993
+
994
+ #### Use it
995
+
996
+ Try typing:
997
+
998
+ ```bash
999
+ dar-backup --<TAB>
1000
+ ```
1001
+
1002
+ You should see all available flags like --full-backup, --restore, etc.
1003
+
1004
+ Try completion of backup definition and then list contents:
1005
+
1006
+ ```bash
1007
+ dar-backup --backup-definition <TAB>
1008
+ dar-backup -d <the chosen backup-definition> --list-contents <TAB>
1009
+ ```
1010
+
1011
+ #### Archive name completion (smart, context-aware)
1012
+
1013
+ When using `manager--list-archive-contents`, the tab-completer suggests valid archive names.
1014
+
1015
+ The behavior is smart and context-aware:
1016
+
1017
+ - If a --backup-definition (-d) is provided, archive suggestions are restricted to that .db catalog.
1018
+
1019
+ - If no backup definition is given, the completer will:
1020
+
1021
+ - Scan all .db files in the backup_dir
1022
+
1023
+ - Aggregate archive names across all catalogs
1024
+
1025
+ - Sort results by:
1026
+
1027
+ - Backup name (e.g. pCloudDrive, media-files)
1028
+
1029
+ - Date inside the archive name (e.g. 2025-04-19)
1030
+
1031
+ It’s blazing fast and designed for large backup sets.
1032
+
1033
+ ```bash
1034
+ # With a backup definition
1035
+ manager -d pCloudDrive --list-archive-contents <TAB>
1036
+ # ⤷ Suggests: pCloudDrive_FULL_2025-03-04, pCloudDrive_INCR_2025-04-19, ...
1037
+
1038
+ # Without a backup definition
1039
+ manager --list-archive-contents <TAB>
1040
+ # ⤷ Suggests: all archives across all known backup definitions
1041
+ # ⤷ Example: media-files_FULL_2025-01-04, pCloudDrive_INCR_2025-04-19, ...
1042
+
1043
+ # Filter by prefix
1044
+ manager --list-archive-contents media-<TAB>
1045
+ # ⤷ Suggests: media-files_FULL_2025-01-04, media-files_INCR_2025-02-20, ...
1046
+ ```
1047
+
1048
+ #### Enabling Bash completion
1049
+
1050
+ Try auto completion in your session:
1051
+
1052
+ ```bash
1053
+ eval "$(register-python-argcomplete dar-backup)"
1054
+ eval "$(register-python-argcomplete cleanup)"
1055
+ eval "$(register-python-argcomplete manager)"
1056
+ complete -o nosort -C 'python -m argcomplete cleanup' cleanup
1057
+ complete -o nosort -C 'python -m argcomplete manager' manager
1058
+ ```
1059
+
1060
+ To make it persistent across sessions, add this to your ~/.bashrc:
1061
+
1062
+ ```bash
1063
+ # Enable autocompletion for dar-backup
1064
+ eval "$(register-python-argcomplete dar-backup)"
1065
+ eval "$(register-python-argcomplete cleanup)"
1066
+ eval "$(register-python-argcomplete manager)"
1067
+ # This disables bash sorting, so sorting is by <backup definition> and <date>
1068
+ complete -o nosort -C 'python -m argcomplete cleanup' cleanup
1069
+ complete -o nosort -C 'python -m argcomplete manager' manager
1070
+ ```
1071
+
1072
+ If you're using a virtual environment and register-python-argcomplete isn't in your global PATH, use:
1073
+
1074
+ ```bash
1075
+ # Enable autocompletion for dar-backup
1076
+ eval "$($(which register-python-argcomplete) dar-backup)"
1077
+ eval "$($(which register-python-argcomplete) cleanup)"
1078
+ eval "$($(which register-python-argcomplete) manager)"
1079
+
1080
+ # If it's not working, try reactivating your virtualenv and restarting your terminal.
1081
+ ```
1082
+
1083
+ Then reload your shell:
1084
+
1085
+ ```bash
1086
+ source ~/.bashrc
1087
+ ```
1088
+
1089
+ #### Enable Zsh Completion
1090
+
1091
+ If you're using Zsh, add this to your .zshrc:
1092
+
1093
+ ```zsh
1094
+ autoload -U bashcompinit
1095
+ bashcompinit
1096
+ eval "$(register-python-argcomplete dar-backup)"
1097
+ eval "$(register-python-argcomplete cleanup)"
1098
+ eval "$(register-python-argcomplete manager)"
1099
+ ```
1100
+
1101
+ Then reload Zsh:
1102
+
1103
+ ```zsh
1104
+ source ~/.zshrc
1105
+ ```
1106
+
952
1107
  ## Todo
953
1108
 
1109
+ - When run interactively, a progress bar during test and par2 generation would be nice.
954
1110
  - Look into a way to move the .par2 files away from the `dar` slices, to maximize chance of good redundancy.
955
1111
  - Add option to dar-backup to use the `dar` option `--fsa-scope none`
956
1112
 
@@ -962,54 +1118,65 @@ One backup definition per file
962
1118
 
963
1119
  .par2 files created for each slice (may be moved in future)
964
1120
 
1121
+ ## Projects these scripts benefit from
1122
+
1123
+ 1. [The wonderful dar achiver](https://github.com/Edrusb/DAR)
1124
+ 2. [The Parchive suite](https://github.com/Parchive)
1125
+ 3. [shellcheck - a bash linter](https://github.com/koalaman/shellcheck)
1126
+ 4. [Ubuntu of course :-)](https://ubuntu.com/)
1127
+ 5. [PyPI](https://pypi.org/)
1128
+ 6. Tracking PyPI downloads with [pypi-total-downloads-tracker](https://github.com/per2jensen/pypi-total-downloads-tracker)
1129
+
965
1130
  ## Reference
966
1131
 
967
1132
  ### CLI Tools Overview
968
1133
 
969
- | Command | Description |
970
- |-----------------------|-------------------------------------------|
971
- | `dar-backup` | Perform full, differential, or incremental backups with verification and restore testing |
972
- | `manager` | Maintain and query catalog databases for archives |
973
- | `cleanup` | Remove outdated DIFF/INCR archives (and optionally FULLs) |
974
- | `clean-log` | Clean up excessive log output from dar command logs |
975
- | `installer` | Set up required directories and default config files |
976
- | `dar-backup-systemd` | Generate (and optionally install) systemd timers and services for automated backups |
1134
+ | Command | Description |
1135
+ |----------------------|-------------------------------------------|
1136
+ | [dar-backup](#dar-backup-options)| Perform full, differential, or incremental backups with verification and restore testing |
1137
+ | [manager](#manager-options) | Maintain and query catalog databases for archives |
1138
+ | [cleanup](#cleanup-options) | Remove outdated DIFF/INCR archives (and optionally FULLs) |
1139
+ | [clean-log](#clean-log-options) | Clean up excessive log output from dar command logs |
1140
+ | [dar-backup-systemd](#dar-backup-systemd-options) | Generate (and optionally install) systemd timers and services for automated backups |
1141
+ | [installer](#installer-options) | Set up directories and optionally create catalog databases according to a config file |
1142
+ | [demo](#demo-options) | Set up required directories and default config files |
977
1143
 
978
1144
  ### test coverage
979
1145
 
980
1146
  Running
981
1147
 
982
- ```` bash
1148
+ ```bash
983
1149
  pytest --cov=dar_backup tests/
984
- ````
1150
+ ```
985
1151
 
986
- results for a dev version 0.6.19 in this report:
1152
+ Results for a version 0.6.19 in this report:
987
1153
 
988
- ```` code
989
- ---------- coverage: platform linux, python 3.12.3-final-0 -----------
1154
+ ```text
990
1155
  Name Stmts Miss Cover
991
1156
  ----------------------------------------------------------
992
1157
  src/dar_backup/__about__.py 1 0 100%
993
1158
  src/dar_backup/__init__.py 0 0 100%
994
1159
  src/dar_backup/clean_log.py 68 13 81%
995
- src/dar_backup/cleanup.py 193 17 91%
996
- src/dar_backup/command_runner.py 73 1 99%
997
- src/dar_backup/config_settings.py 66 8 88%
998
- src/dar_backup/dar_backup.py 535 56 90%
1160
+ src/dar_backup/cleanup.py 196 17 91%
1161
+ src/dar_backup/command_runner.py 80 3 96%
1162
+ src/dar_backup/config_settings.py 66 7 89%
1163
+ src/dar_backup/dar_backup.py 539 56 90%
999
1164
  src/dar_backup/dar_backup_systemd.py 56 7 88%
1000
1165
  src/dar_backup/installer.py 59 6 90%
1001
- src/dar_backup/manager.py 351 56 84%
1166
+ src/dar_backup/manager.py 403 54 87%
1002
1167
  src/dar_backup/rich_progress.py 70 7 90%
1003
- src/dar_backup/util.py 130 15 88%
1168
+ src/dar_backup/util.py 231 24 90%
1004
1169
  ----------------------------------------------------------
1005
- TOTAL 1602 186 88%
1006
- ````
1170
+ TOTAL 1769 194 89%
1171
+ ```
1007
1172
 
1008
- ### dar-backup options
1173
+ ### Dar-backup options
1009
1174
 
1010
- This script does backups, validation and restoring. It has the following options:
1175
+ This script does backups including par2 redundancy, validation and restoring.
1011
1176
 
1012
- ``` code
1177
+ Available options:
1178
+
1179
+ ```bash
1013
1180
  -F, --full-backup Perform a full backup.
1014
1181
  -D, --differential-backup Perform a differential backup.
1015
1182
  -I, --incremental-backup Perform an incremental backup.
@@ -1028,34 +1195,39 @@ This script does backups, validation and restoring. It has the following options
1028
1195
  --log-level <level> `debug` or `trace`, default is `info`.
1029
1196
  --log-stdout Also print log messages to stdout.
1030
1197
  --do-not-compare Do not compare restores to file system.
1031
- -v --version Show version and license information.
1198
+ -v, --version Show version and license information.
1032
1199
  ```
1033
1200
 
1034
- ### manager options
1201
+ ### Manager Options
1202
+
1203
+ This script manages `dar` databases and catalogs.
1035
1204
 
1036
- This script manages `dar` databases and catalogs. Available options:
1205
+ Available options:
1037
1206
 
1038
- ``` code
1039
- -c, --config-file Path to dar-backup.conf
1207
+ ```bash
1208
+ -c, --config-file <path> Path to dar-backup.conf.
1040
1209
  --create-db Create missing databases for all backup definitions.
1041
1210
  --alternate-archive-dir <path> Use this directory instead of BACKUP_DIR in the config file.
1042
1211
  --add-dir <path> Add all archive catalogs in this directory to databases.
1043
- -d, --backup-def <name> Restrict to work only on this backup definition.
1044
- --add-specific-archive <archive> Add this archive to the catalog database.
1045
- --remove-specific-archive <archive> Remove this archive from the catalog database.
1212
+ -d, --backup-def <name> Restrict operations to this backup definition.
1213
+ --add-specific-archive <archive> Add a specific archive to the catalog database.
1214
+ --remove-specific-archive <archive> Remove a specific archive from the catalog database.
1046
1215
  -l, --list-catalogs List catalogs in databases for all backup definitions.
1047
- --list-catalog-contents <num> List contents of a catalog by catalog number.
1048
- --list-archive-contents <archive> List contents of an archive’s catalog, given the archive name.
1216
+ --list-archive-contents <archive> List the contents of an archive’s catalog by archive name.
1049
1217
  --find-file <file> Search catalogs for a specific file.
1050
1218
  --verbose Enable verbose output.
1051
- --log-level <level> `debug` or `trace`, default is `info`", default="info".
1219
+ --log-level <level> Set log level (`debug` or `trace`, default is `info`).
1052
1220
  ```
1053
1221
 
1054
- ### cleanup options
1222
+ ### Cleanup options
1055
1223
 
1056
- This script cleans up old backups and par2 files. Supported options:
1224
+ This script removes old backups and par2 files according to `[AGE]` settings in config file.
1057
1225
 
1058
- ``` code
1226
+ Catalogs in catalog databases are also removed.
1227
+
1228
+ Supported options:
1229
+
1230
+ ```bash
1059
1231
  -d, --backup-definition Backup definition to cleanup.
1060
1232
  -c, --config-file Path to 'dar-backup.conf'
1061
1233
  -v, --version Show version & license information.
@@ -1068,11 +1240,11 @@ This script cleans up old backups and par2 files. Supported options:
1068
1240
  --test-mode This is used when running pytest test cases
1069
1241
  ```
1070
1242
 
1071
- ### clean-log options
1243
+ ### Clean-log options
1072
1244
 
1073
1245
  This script removes excessive logging output from `dar` logs, improving readability and efficiency. Available options:
1074
1246
 
1075
- ``` code
1247
+ ```bash
1076
1248
  -f, --file <path> Specify the log file(s) to be cleaned.
1077
1249
  -c, --config-file <path> Path to dar-backup.conf.
1078
1250
  --dry-run Show which lines would be removed without modifying the file.
@@ -1080,9 +1252,33 @@ This script removes excessive logging output from `dar` logs, improving readabil
1080
1252
  -h, --help Displays usage info
1081
1253
  ```
1082
1254
 
1083
- ### installer options
1255
+ ### Dar-backup-systemd options
1256
+
1257
+ Generates and optionally install systemd user service units and timers.
1258
+
1259
+ ```bash
1260
+ -h, --help Show this help message and exit
1261
+ --venv VENV Path to the Python venv with dar-backup
1262
+ --dar-path DAR_PATH Optional path to dar binary's directory
1263
+ --install Install the units to ~/.config/systemd/user
1264
+ ```
1265
+
1266
+ ### Installer options
1267
+
1268
+ Sets up `dar-backup` according to provided config file.
1084
1269
 
1085
- Sets up `dar-backup`for a user.
1270
+ The installer creates the necessary backup catalog databases if `--create-db` is given.
1271
+
1272
+ ```bash
1273
+ --config Sets up `dar-backup`.
1274
+ --create-db Create backup catalog databases.
1275
+ -v, --version Display version and licensing information.
1276
+ -h, --help Displays usage info
1277
+ ```
1278
+
1279
+ ### Demo options
1280
+
1281
+ Sets up `dar-backup` in a demo configuration.
1086
1282
 
1087
1283
  It is non-destructive and stops if directories are already in place.
1088
1284
 
@@ -1099,19 +1295,8 @@ Sets up demo config files:
1099
1295
  - ~/.config/dar-backup/dar-backup.conf
1100
1296
  - ~/.config/dar-backup/backup.d/default
1101
1297
 
1102
- ``` code
1298
+ ```bash
1103
1299
  -i, --install Sets up `dar-backup`.
1104
1300
  -v, --version Display version and licensing information.
1105
1301
  -h, --help Displays usage info
1106
1302
  ```
1107
-
1108
- ### dar-backup-systemd
1109
-
1110
- Generates and optionally install systemd user service units and timers
1111
-
1112
- ``` code
1113
- -h, --help Show this help message and exit
1114
- --venv VENV Path to the Python venv with dar-backup
1115
- --dar-path DAR_PATH Optional path to dar binary's directory
1116
- --install Install the units to ~/.config/systemd/user
1117
- ```