1

I want to copy files /SRC/**/OK/**/*OK* to /DEST/**/OK/**/*OK* using rsync.

For all the files to copy, there must be a folder named OK in the full path and a OK in the filename.

I tried

rsync -avP --include='**/OK/**/*OK*' --include='*/' --exclude='*' --inplace SRC DEST

It doesn't work.

rsync -avP --include='*OK*' --include='*/' --exclude='*' --inplace SRC DEST

works but it creates all the folders, no matter whether they contain OK in the full path or not.

1 Answer 1

0
rsync -am --include='**/OK/**/*OK*' --include='*/' --exclude='*' --delete-excluded SRS DEST

Try this one. -m deletes "empty" directories that were created while traversing SRS sub directories, and --delete-excluded to make rsync not look like cp.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.