find 详述
先创10个TXT touch aa{01…10}.txt
查找移动
find /test -type f -name “*.txt”|xargs mv -t /test01/ 查找移动
1 :文件所在的路径 2 :文件名 3:要被移动到的
查找复制
find /test -type f -name “*.txt”|xargs cp -t /test01/ 查找复制到
分隔线 分隔线 分隔线 分隔线 分隔线 分隔线 分隔线 分隔线 分隔
查找删除
find /test -type f -name “.txt" - -delete 查找删除
find /test -type f -name ".txt” -exec rm -rf {} ; 删除方法2
find /test -maxdepth 1 -type f -name “.txt" | xargs rm -f 方法3
rm -rf $(find /test/ -type f -name ".txt”) 方法4
查找压缩
find /test -maxdepth 1 -type f -name “.txt" | xargs tar zcvf /test/aa.tar.gz 方法1
tar zcvf /test/aa.tar.gz 'find /test/ -maxdepth 1 -type f -name ".txt” ’ 方法2(不太好使)
tar -tf 压缩包 —验证压缩