I am looking to use rsync to write log data to an external USB drive connected to a linux server.

The command below is writing all data and not just from October.

sudo rsync -av -r --progress --include **2018-10-** . /mnt/ext1/

The data I need from October can be found in various classes with varying directories.

1 Answer 1

rsync -av --include="*/" --include="*2018-10*" --exclude="*" . /mnt/ext1/

You should first include everything you want and then exclude the rest. Use --dry-run to check if everything is working as you like and -m if you don't want the empty directories to be copied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.