How to rsync particular extension files ?

rsync

The rsync command is the greatest tool to syncronize data from the source, The rsync has lot of option to simplify the work. I am going to explain the amazing feature from the same. 

Sometimes we need to syncronize some particular extenstion from the source, The rsync has the simple and coolest solutions for that. The following command will syncronize the particular extenstions from the source.

rsync -rv --include '*' --include '*.jpg' --exclude '*' --prune-empty-dirs /source-path /destination-path

This will generate the same structure found in source into destination but only including the jpg extension files.

Will explain each options one by one,

  1. --include '*' - Option to make sure all subdirectories are scanned.
  2. --prune-empty-dirs - To remove the empty directories.
  3. --include '*.jpg' - Option is rather explanatory , and you can add more as you need.
  4. --exclude '*' - Finally exclude all other files, we don't want using.
Tags: