Find and delete files that meet the conditions in linux, and find files that meet the conditions in linux.
Find all the files starting with test in the root directory and pass the search result as a parameter to the rm-rf command to delete the files:
1. find/-name "test *" | xargs rm-rf
2. find/-name "test *"-exec rm-rf {}\;
3. rm-rf $ (find/-name "test ")
To specify the recursive depth, you can:
1. find/-maxdepth 3-name "*. mp3" | xargs rm-rf
2. find/-maxdepth 3-name "test *"-exec rm-rf {}\;
3. rm-rf $ (find/-maxdepth 3-name "test ")
In this way, only the files matching the conditions in the three-tier directory will be searched and deleted!
The find command in linux is too powerful. Continue to study .............................
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.