Rsync to copy specific subfolders and files to new directory

RootFolderI:

    RootFolderI/FolderA/Subfolder1/Subsub1/JPG1.jpg -> want this jpg
    RootFolderI/FolderA/Subfolder2/Subsub1/JPG2.jpg -> want this jpg
    RootFolderI/FolderA/Subfolder2/Subsub2/JPG3.jpg
    . . .
    RootFolderI/FolderB/Subfolder1/Subsub1/JPG4.jpg -> want this jpg
    RootFolderI/FolderB/Subfolder2/Subsub1/JPG5.jpg -> want this jpg
    RootFolderI/FolderB/Subfolder3/Subsub2/JPG6.jpg
    ...

There are many folders FolderA/B/C/etc, but the structure of folders inside is always the same (except the files, they are different)
_______________

I want to copy to `RootFolderII`:

  • only all the FolderA/B/etc
  • all the files in Subsub1

...Resulting is this new path, RootFolderII:

    RootFolderII/FolderA/ with JPG1.jpg, JPG2.jpg
    RootFolderII/FolderB/ with JPG4.jpg,JPG5.jpg

_________

I've got at the moment the following code (but it's not working):

    rsync -r --include='Folder*/Subfolder1/Subsub1/***' --exclude="/*/*/" /RootFolderI/ /RootFolderII/

Where

 --exclude="/*/*/" 

to create FolderA/B/... -> working

 `--include='Folder*/Subfolder1/Subsub1/***'`

i want to copy all files (not the structure) ... -> it's not working

 `???`

well, I think even if it was working, it would copy files from FolderB to FolderA, and I don't want that!

try below code

rsync -rv --dry-run  --include='*/*/Subsub1/*' --exclude='*/*/Subsub2/*' ./RootFolderI/ ./RootFolderII/

Remove --dry-run option if you are good with o/p