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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.