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?
Best Answer
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
And the rsync command to back up folders inc1 and inc2 in your home directory would be
rsync is very flexible, you are best off consulting the man page first and if you get stuck asking a more specific question.