linux copy exclude directory

if u want to copy all files in a directory except some files in a specific sub-directory. unfortunately ‘cp’ command didn’t have a –exclude option.

still u can work around this issue using rsync command as it can work locally too, not only remotely.

rsync -av –progress /source/folder /destination/folder –exclude /source/folder/exclude

You can use --exclude multiples times.

Also you can add -n for dry run to see what will be copied before performing real operation, and if everything is ok, remove -n from command line.