Use rsync to copy all files except for certain filenames with a certain extension
Solution 1:
This would be significantly easier using rsync with its --exclude
switch.
rsync -av --exclude='*.FOO' --exclude='*.BAR' --exclude='*.ZIM' /source /dest
The -v
switch will provide verbose output on which files are being synchronised.
Solution 2:
If you have large number of extensions to exclude you can make a file and write down all the extension or file to exclude and use only one exclude option to make it simple.
rsync -ravz --exclude='./abc,txt' /source /dest
It is always good to use z for compression and r option if you have to copy recursively.