Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 14726  / 2 Years ago, thu, june 30, 2022, 7:15:47

How can I specify specific files to include/exclude in grsync/rsync?



Currently, I use different operations to backup files from only specified folders. I want to do it now in 1 pass. I think I should be looking at the include/exclude options?



Suppose I have a folder structure like



/
/inc1
/inc1.1
/...
/inc2
/...
/exc1
files in root here ...


I want to only backup files/folders from inc1 & inc2 how can I do it?


More From » backup

 Answers
2

You can use --include and --exclude options or for a backup process you may want to use --include-from so you can list the folders you want to back up in a file.



For example your file may be called includes.txt and save in your home directory.
It would contain



  inc1/
inc2/


And the rsync command to back up folders inc1 and inc2 in your home directory would be



rsync $HOME --include-from=~/includes.txt /home/backup/


rsync is very flexible, you are best off consulting the man page first and if you get stuck asking a more specific question.


[#43933] Friday, July 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mentpengu

Total Points: 148
Total Questions: 114
Total Answers: 119

Location: Anguilla
Member since Sun, Aug 7, 2022
2 Years ago
mentpengu questions
Sun, Apr 17, 22, 18:09, 2 Years ago
Fri, Aug 12, 22, 01:35, 2 Years ago
Tue, Jul 26, 22, 14:52, 2 Years ago
;