How does rsync synchronize hidden and excluded files?

Source: Internet
Author: User
Tags command line svn rsync

How does rsync synchronize hidden and excluded files?

The basic writing of rsync Synchronization command

?

1 rsync command Options source directory target directory

If the source directory is written as/var/www/, all files in the directory are synchronized to the target directory, and if written as/var/www/*, the hidden files in the current directory (the folder name or filename is "."). Sign) is not synchronized, but the hidden files in the subdirectory are still synchronized.

Suppose you need to exclude a file (or folder), you can specify it with –exclude, such as the need to exclude the Dir1 folder under the source directory, which can be written as:

?

1 /usr/bin/rsync-vzrtopg–exclude=dir1/var/www/src//var/www/dest

You can exclude multiple bars at the same time, for example:

?

1 /usr/bin/rsync-vzrtopg–exclude=dir1–exclude=dir2/var/www/src//var/www/dest

In addition to the above methods, you can also specify by –exclude-from, for example:

?

1 /usr/bin/rsync-vzrtopg–exclude-from=exclude.list/var/www/src//var/www/dest

In the Exclude.list file, specify the list you want to exclude, for example:

?

1 2 3 4 Dir1 [0-9]* dir2/. [a-z0-9]*. SVN

The implication is to exclude all the. SVN folders in the/var/www/dir1,/var/www directory, and all the files and folders that are digitally named,/var/www/dir2/directories, and/var/www directories, including the. svn folder in their subdirectories.

Note: There are two minus signs in front of exclude and exclude-from, and if one is omitted, the command line does not report an error, but the executed file or folder cannot be excluded.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.