rsync exclude files or folders

Written by
Date: 2012-12-23 15:37:32 00:00


rsync is a powerful command, I use it a lot to backup files, or to sync files between computers.

But, there are times when you do not want to have an exact copy in the remote server from the files in the local server. If you want to exclude some files from syncing you can use --exclude option.

Exclude a single file

rsync -avz --exclude 'file' source/ destination/

Exclude a type of files

rsync -avz --exclude '*.typ' source/ destination/

Exclude a folder

rsync -avz --exclude 'folder' source/ destination/

Exclude multiple files or folders

rsync -avz --exclude '*.file_type' --exclude 'folder' source/ destination/