I have a directory with the following structure:
-- 201893208 └── 8Z12 └── ko_8Z12_Full └── wp_we_8Z12_FullDAT └── 8Z12_DATFull └── P011 └── P011_Full └── 8Z12_FullDAT └── P011_DATFull └── 9FZA └── kl_wt-we-w_kl9-9FZA_Full └── ffd-9FZA_FullDAT └── 8fdZ12232_9FZA_DATFull -- 903240920 └── P0fsa └── P0fsa_Full └── P0fsa_FullDAT └── P0fsa_DATFull └── Paaaf └── we-Paaaf_ww_fl_Full └── Paaaf_FullDAT └── Paaaf_DATFull └── 9FZATYYY └── 9FZATYYY_Full └── 9FZATYYY_FullDAT -- wt0340291 └── OPF1121 └── OPF1121_Full └── 8Z12_DATFull └── KLOFJ9 └── lop_KLOFJ9_ffj_Full └── powt_KLOFJ9_DATFull └── LP02323 └── wr_we_LP02323_Full └── wr_we_LP02323_FullDAT
There are thousands of files in each and every folder listed above. And then there are also many subdirectories inside each. For example
8Z12 does not contain only the three folders listed above, but it also contains thousands of files.
I ONLY want to copy directories which have
_Full at the end of their name (DATFull directories should NOT be copied) AND also contain the patterns in the list below
LP02323 KLOFJ9 Paaaf 9FZA
In other words, the directories that contain a string from the list above AND
Full in their name (but NOT DAT) should be copied.
Therefore in the example above, only the following directories (and all of their contents and sub-directories) should be copied:
wr_we_LP02323_Full lop_KLOFJ9_ffj_Full we-Paaaf_ww_fl_Full kl_wt-we-w_kl9-9FZA_Full
To my understanding,
rsync does not support regex, therefore this has to be done with
find first of all (correct me if I am wrong). But how can I do this in a way to ensure all of the directories and sub-directories are checked and all of the relevant folders are copied even if they are buried very deep in several sub-directories (note that the above example was a simplified structure of my original folder).
So there are two questions:
- How can I provide the list of patterns to
- How can I pipe the result of
So far this only comes to my mind to match
find . -regextype sed -regex ".*/.*[^DAT]Full$"
But how can I add the list of IDs to this