Hi let's say I have a directory like this:
/
my_work
/dir1
keepdir1.ddd
keepdir2.ddd
file.cfg
(lots of files and directories I don't want)
/dir2
(same layout as dir 1)
So I want to copy the directory "my_work" and all of the "dir1", "dir2", etc sub directories. But within each of those I want to keep only certain files, and certain directories. In the directories I keep I want to recursively include everything.
Here's what I've tried so far but nothing seems to copy:
rsync -rl --include-from=~/rsync_include /my_work ~/backup
And the contents of rsync_include are:
+ *file.cfg
+ *keepdir*/*
- *
Update:
If I run with rsync -rvvl I get:
sending incremental file list
[sender] hiding directory my_work because of pattern *
delta-transmission disabled for local transfer or --whole-file
total: matches=0 hash_hits=0 false_alarms=0 data=0
sent 10 bytes received 12 bytes 44.00 bytes/sec
total size is 0 speedup is 0.00
The final
- *
is ignoring everything that hasn't explicitly matched one of the preceding rules. This is what you want, but because the top level folders don't match, rsync won't even descend into them, so it won't have a chance to match the file patterns you've specified.If you add:
explicitly to the top of the file, then it should work.