测试find 命令删除文件速度
新建10000个文件
#!/bin/bash mkdir -p test for ((i=1; i<=10000; i++)) do touch ./test/$(date +%H%M%S%N).txt done
测试find -delete
time find ./test/* -delete
real 0m0.196s
user 0m0.109s
sys 0m0.086s
测试find -exec
time find ./test/* -exec rm -f {} \;
real 0m8.963s
user 0m3.612s
sys 0m5.651s
测试xargs
time find ./test/* |xargs rm -f
real 0m0.192s
user 0m0.108s
sys 0m0.107s