Find Tar compresses the first-level directory for data backup.

Source: Internet
Author: User

Find *.tar.gz-exec tar zxvf ' {} ';
Find the files for. tar.gz in the current directory and send them to the following command execution
Find. -maxdepth 1
Find the files in the current directory and display them.
Find. -maxdepth 1-type D
Find files in the current directory

Find. -maxdepth 1-type d-exec cp-r ' {} '/home/android/autonavi-project/'; '
Find the current directory and copy it to a location

Find. -maxdepth 1-type d-exec tar zcvf ' {} '. tar.gz ' {} '; '
Compresses the current directory and puts it into the current directory.
-maxdepth 0 indicates that the current directory is displayed before the other.
Find. -maxdepth 1-type d-exec tar zcvf/test2/' {} '. tar.gz ' {} '; '
Compresses the current directory and puts it into the specified (/test2/).

find/test-path/test/a-prune-o-name "*"-print
Find files other than a folder in the test directory


Find/test2-path/test2/a.tar.gz-prune-o-name "*"-print
Find all the files and directories in the Test2 directory except for a.tar.gz.

find/test2-path/test2/. Tar.gz-prune-o-name "*.tar.gz"-exec tar zxvf ' {} ';
Find the Test2 directory except for: tar.gz all of the. tar.gz for decompression.

find/test2-path/test2/. -prune-o-name "*"-exec tar zcvf ' {} '. tar.gz ' {} ';
Find the Test2 directory except for. All directories outside this directory are compressed.


The ultimate goal of this file is to compress the directory under one directory. Does not compress the current directory. And does not compress the out file.
Find. -mindepth 1-maxdepth 1-path "./out"-prune-o-type d-exec tar zcvf ' {} '. tar.gz ' {} '; '
//

Find Tar compresses the first-level directory for data backup.

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.