How to exclude files/folders from rsync

In some cases we need to exclude one or more files (or directories) from the rsync. Se can use exclude options to skip files/folder from rsync.

The complete syntax is as follows.

#rsync -arv --exclude=folder1 --exclude=folder2 source destination

Here we need to replace,

folder1 with the first folder need to exclude
folder2 with the second folder need to exclude
source with the location from which the file/folder need to copy
destination with the location to which the file/folder need to copy

Note that exlude path is always relative.

We can use the same syntax for exluding the files too.

Leave a Reply