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,
- --include '*' - Option to make sure all subdirectories are scanned.
- --prune-empty-dirs - To remove the empty directories.
- --include '*.jpg' - Option is rather explanatory , and you can add more as you need.
- --exclude '*' - Finally exclude all other files, we don't want using.