$ rsync -avz -exclude 'dir*' source/ destination/ The following example will exclude any directory (or subdirectories) under source/ that matches the pattern “dir*” $ rm -rf destination Exclude multiple directories that matches a pattern $ find destinationĭestination/dir3/file4.txt 2. Verify to make sure dir1 is not copied from source directory to destination directory. $ rsync -avz -exclude 'dir1' source/ destination/ If you don’t want to sync the dir1 (including all it’s subdirectories) from the source to the destination folder, use the rsync –exclude option as shown below. The above command will create a source directory (under your home directory) with the following structure. This article explains how to ignore multiple files and/or directories during rsync with examples.įirst, create a sample directory structure as shown below (with some empty files) that can be used for testing purpose. You might also want to exclude a specific file type from rsync. In a typical backup situation, you might want to exclude one or more files (or directories) from the backup. You know this already, as we presented you with practical examples on rsync earlier. Rsync is very powerful tool to take backups, or sync files and directories between two different locations (or servers).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |