Say I have the following structure on path origin_path
origin_path/X=1/A/...
origin_path/X=1/B/...
origin_path/X=1/C/...
...
origin_path/X=2/A/...
origin_path/X=2/B/...
origin_path/X=2/C/...
...
...
I would like to replicate the structure above at a different path called destination_path
, but only including the paths corresponding to the directories B above.
In other words, I would like to get the following at destination_path
destination_path/X=1/B/...
destination_path/X=2/B/...
destination_path/X=3/B/...
...
To clarify, some of this structure in destionation path might exist already (e.g. the folders destination_path/X=*
).
From what I understand, thanks to @Gilles' comment, rsync
filters may be a great fit for this. However, I have never used them before and it's a bit hard for me to extrapolate the example provided in Rsync filter: copying one pattern only to my situation.
In what order should I include or exclude things in my case? And how do I tell rsync to use origin_path
and destination_path
as global paths? (as opposed to having it copy things with relative paths)
rsync
filters are a great fit for this. I went through your answer and read about them a bit more online, but I am not sure how what would be the right rule here. I'll clarify my question too.