Rsync synchronizes hidden and excluded files

Source: Internet
Author: User

Basic rsync command syntax

Rsync Command Option source directory target directory

If the source directory is/var/www/, all the files in the directory will be synchronized to the target directory. If it is/var/www /*, the hidden file in the current directory (the folder name or file name is ". but the hidden files in the subdirectories will still be synchronized.

If you want to exclude a file (or folder), you can use-Exclude. For example, to exclude the dir1 folder under the source directory, you can write it:

/Usr/bin/rsync-vzrtopg-exclude = dir1/var/www/src // var/www/dest

Multiple Entries can be excluded at the same time, for example:

/Usr/bin/rsync-vzrtopg-exclude = dir1-exclude = dir2/var/www/src // var/www/dest

In addition to the above method, you can also use-Exclude-from:

/Usr/bin/rsync-vzrtopg-exclude-from = exclude. list/var/www/src // var/www/dest

The exclude. list file specifies the list to be excluded, for example:

Dir1
[0-9] *
Dir2/. [a-z0-9] *
. Svn

It means to exclude all files and folders named by numbers in the/var/www/dir1,/var/www directory, hidden files under the/var/www/dir2/directory, and/ var/www directory all. svn folder, including. svn folder.

Note: Both exclude and exclude-from have two minus signs. If one is missing, the command line will not report an error, but the executed files or folders 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.