linux find rm ls 逻辑非运用

需求场景描述

查找出除已知文件外的文件

办法:

[root@VM_58_118_centos test]# find ./ -type f ! -name TPS650_ALL_sv5.1.1_fv1.0.0_pv1.0.6_15752678845473.zip ! -name TPS781_ALL_sv7.1.2_fv1.0.4_pv1.0.4-9.9.9_15753611341161.zip | xargs tar -czvf ota_2019_12.tar.gz
[root@VM_58_118_centos test]# find ./ -type f ! -name ota_2019_12.tar.gz ! -name TPS650_ALL_sv5.1.1_fv1.0.0_pv1.0.6_15752678845473.zip ! -name TPS781_ALL_sv7.1.2_fv1.0.4_pv1.0.4-9.9.9_15753611341161.zip | xargs rm -f


[root@VM_58_118_centos 12]# rm -rf !(3.rar|1.txt)
[root@VM_58_118_centos 12]# ls -l !(*.zip) 
[root@VM_58_118_centos 12]# ls -l !(TPS986_ALL_sv7.1.2_fv1.0.0_pv1.0.0-1.0.1_15732019862871.zip|TPS983_ALL_sv7.1.2_fv1.0.0_pv1.0.0-1.0.1_15725761713444.zip) 

猜你喜欢

转载自www.cnblogs.com/hnhycnlc888/p/12023512.html
今日推荐