How do I copy an entire directory and ignore some files and directories (including Windows)?

Source: Internet
Author: User

I have a directory A, which has a subdirectory B, and the file C.log, I want to put directory A in addition to the B and C.log files and directories to the D directory, in addition to exclude all SVN directory, how to write this statement?

Method One:

Find A (-path A/b-o-path a/*.svn)-prune-o-print |cpio-o >/tmp/a.cpio
Then go to the TMP directory
Cpio-i < A.cpio

Method Two:

Using the rsync command, thank you very much:

rsync -R --Delete --exclude=". SVN"- -Exclude="B" --exclude="C.log" /A/ /D

Much better than the CP command, the other excluded files and directories can also be written into a file:

rsync -R --Delete --exclude-from=rsync. Exclude /A/ /D

The contents of the Rsync.exclude file are:

1 . SVN 2 B 3 C.log

Rsync is particularly good with the window client, which also achieves the same effect under window.

How do I copy an entire directory and ignore some files and directories (including Windows)?

Related Article

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.