I am currently looking at "Include" switch for rewrite command · Issue #4278 · restic/restic · GitHub . I have written a first very rough version which accepts include and exclude filters (exclusively). When I am including something like /home/user/subdirectory/**/*.go, all directories of the extisting snapshot have to be included in the rewritten snapshot, so the included files can be found.
This can potentially create a lot of empty subdirectories. Any ideas of how to avoid a lot of empty subdirectories?
Thanks
You have not posted what you are doing in details. Only some partial description.
As mentioned in many other posts:
When you created your post, you were asked to provide a set of information such as the restic version, commands, all of their output, etc. You did not do this, and for that reason it is impossible for us to answer exactly why you are seeing what you are seeing.
restic version is “restic 0.17.1-dev (v0.17.1-154-g4a6159591-dirty) compiled with go1.22.0 on linux/amd64”
command is: ./restic -r rclone:onedrive:restic_home rewrite aca4a111 -i "/home/wplapper/Filekeys/**/*.py" -vv
, btw: the -i parameter is mine.
output is:`
snapshot aca4a111 of [/home] at 2024-09-01 08:34:46.817443978 +0100 BST by wplapper@XPS-15-9550
loading current backup aca4a111 from 2024-09-01 08:34:46 for XPS-15-9550:/home
total_files_processed 19 <<< new output
total_bytes_processed 136937 <<< new output
saved new snapshot 46d8fefd
modified 1 snapshots
`
The output of ./restic -r rclone:onedrive:restic_home ls -l 46d8fefd | grep -v "^d"
is:
snapshot 46d8fefd of [/home] at 2024-09-01 08:34:46.817443978 +0100 BST by wplapper@XPS-15-9550 filtered by :
-rwxrwxr-x 1000 1000 2756 2020-07-05 05:21:01 /home/wplapper/Filekeys/count_DB_records.py
-rw-rw-r-- 1000 1000 2440 2019-05-26 09:32:19 /home/wplapper/Filekeys/create_tables.py
-rwxrwxr-x 1000 1000 4463 2020-09-02 16:01:42 /home/wplapper/Filekeys/db_fragentation-v2.py
-rwxrwxr-x 1000 1000 6884 2019-06-07 10:19:42 /home/wplapper/Filekeys/dbstat.py
-rwxrwxr-x 1000 1000 22247 2021-12-22 18:26:40 /home/wplapper/Filekeys/filekeys_declarative.py
-rwxr-xr-x 1000 1000 3146 2018-08-04 08:39:37 /home/wplapper/Filekeys/tools/check_for_multiple_inodes.py
-rwxrwxr-x 1000 1000 2923 2018-08-01 04:06:53 /home/wplapper/Filekeys/tools/check_mtime_in_database.py
-rwxrwxr-x 1000 1000 6023 2018-08-05 13:51:12 /home/wplapper/Filekeys/tools/copy_or_link_files-v2.py
-rwxr-xr-x 1000 1000 6424 2018-08-04 18:20:32 /home/wplapper/Filekeys/tools/copy_or_link_files.py
-rwxrwxr-x 1000 1000 502 2018-08-22 19:46:51 /home/wplapper/Filekeys/tools/gen_dates.py
-rwxrwxr-x 1000 1000 1414 2018-05-28 13:08:52 /home/wplapper/Filekeys/tools/inode_analysis.py
-rwxrwxr-x 1000 1000 885 2018-06-05 06:32:40 /home/wplapper/Filekeys/tools/large_files.py
-rwxrwxr-x 1000 1000 4145 2018-08-21 20:51:53 /home/wplapper/Filekeys/tools/merge_inodes_in_backup.py
-rwxrwxr-x 1000 1000 3325 2021-12-22 18:27:43 /home/wplapper/Filekeys/tools/q_double_sqlalchemy.py
-rwxrwxr-x 1000 1000 2923 2018-08-01 04:06:53 /home/wplapper/Filekeys/tools/repair_mtime_in_database.py
-rwxrwxr-x 1000 1000 9788 2018-05-25 21:56:24 /home/wplapper/Filekeys/tools/speed_test.py
-rwxrwxr-x 1000 1000 6460 2020-10-15 19:30:03 /home/wplapper/Filekeys/ubuntu_files/compare_two_databases.py
-rw-rw-r-- 1000 1000 17338 2020-10-15 18:29:07 /home/wplapper/Filekeys/ubuntu_files/databasemodel_sqlite_v5.py
-rwxrwxr-x 1000 1000 32851 2022-01-28 17:31:02 /home/wplapper/Filekeys/ubuntu_files/load_quick.py
and the number of empty directories is >2000.
Please note that is experimental code which is not yet in the public domain.
I have solved the issue of empty directories by optionally running a walker.walk for the current snapshot and filtering in the directories needed for the files to be included.
Thanks for listening!
W
1 Like