I want to backup all office files and the newly created later in one folder and exclude all other types
How to write the exclude file ?
Thank you.
my test data folder tree is below
D:\RESTIC-TEST\DATA
│ 智能匹配系统V3.pdf
│
├───1
│ winserv.exe
│
├───2
│ │ winserv.exe
│ │
│ ├───2-1
│ │ 阿里oss.txt
│ │
│ ├───2-2
│ │ 2021-08-25.log
│ │ 2021-08-30.log
│ │ CACHEDIR.TAG
│ │
│ └───2-3
│ 异步消息推送配置表.xlsx
│
└───3
members.json
WeChat Image_20200722150945.jpg
漏单日志.zip
my restic backup command is
restic -r repo -p key backup --exclude-caches --iexclude-file exclude.txt --files-from file.txt -n -vvv
my file.txt content is
D:/restic-test/data/*.pdf
D:\restic-test\data\2\2-3\*.xlsx
Is it possible to make include file supports walk recursively? so just this line will include all excel file
D:/restic-test/data/**/*.xls[xm]
Hi @kuyagic and welcome to the restic community!
Thanks for the detailed report. Just making sure you haven’t missed this, have you seen the documentation around excluding files?
If not give this a read and see if the information there provides enough information to solve your problem.
https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files
… got same Problem - but in my case only SumatraPDF Files, so I try this:
(I like to use AkelPad to generate a Text-File in UTF-8 Coded)
# OnlySumatraFiles.txt:
## First exclude all Windows-Drive-Letters:
/A/*
/B/*
/C/*
/D/*
/E/*
/F/*
/G/*
/H/*
/I/*
/J/*
/K/*
/L/*
/M/*
/N/*
/O/*
/P/*
/Q/*
/R/*
/S/*
/T/*
/U/*
/V/*
/W/*
/X/*
/Y/*
/Z/*
## Than re-include the wanted File-Types:
!**/*.PDF
!**/*.EPUB
!**/*.MOBI
!**/*.CHM
!**/*.XPS
!**/*.DjVu
!**/*.CBZ
!**/*.CBR
!**/*.JPG
!**/*.JPEG
!**/*.GIF
!**/*.PNG
!**/*.BMP
!**/*.TGA
!**/*.TIF
!**/*.TIFF
!**/*.WEBP
!**/*.txt
I prefer the CMD-Shell in Window - or sometimes a CMD-Script:
A:\> set "RESTIC_REPOSITORY=\\Nas\BackUpDrive\BackUpFolder"
A:\> set "RESTIC_PASSWORD=eins,Zwo-Drei!4"
A:\> set "TMPDIR=%tmp%"
A:\> restic backup --iexclude-file OnlySumatraFiles.txt -x --use-fs-snapshot "%UserProFile%"
and I also can backup any other Drive - maybe an eReader:
A:\> restic backup --iexclude-file OnlySumatraFiles.txt "B:\"
Do you see any Errors?
what does this file OnlySumatraFiles.txt contain?
???
From Backing up — restic 0.16.3 documentation :
[Negative excludes:] It works similarly to
gitignore
, with the same limitation: once a directory is excluded, it is not possible to include files inside the directory
That is once a directory has been excluded (due to the /A/*
patterns), no files in that directory will be backed up. See also Only include some specific file extensions in backup