linux 下结合find 和 rm 删除大量文件

echo "remove only files, the logs folder and it contents will not be removed"
find /opt/trade-disposal -maxdepth 1 -type f -exec rm -fv {} ;
rm -rf /opt/trade-disposal/scripts

{} 是find的结果

; 是命令终结符,用反斜杠转义

删除/home/raven下,包括子目录里所有名为abc.txt的文件:

find /home/raven -name abc.txt | xargs rm -rf

cp `find * -maxdepth 0 -type f -name "tempest-app-disposal-*.jar" -not -name "*-tests.jar"` /opt/disposal/disposal.jar

原文地址:https://www.cnblogs.com/tonggc1668/p/9408697.html