Re: rm -rf is too slow on large files and directory structure(Around 30000)
On Wed, Feb 15, 2012 at 1:38 AM, Jude DaShiell <jdashiel@shellworld.net> wrote:
> Anyone heard of the unlink command?
unlink is slower than rm removing a 1.5GB file (at least on ext3):
cbell@circe:~$ time rm test1
real 0m0.278s
user 0m0.000s
sys 0m0.264s
cbell@circe:~$ time unlink test2
real 0m0.375s
user 0m0.000s
sys 0m0.364s
cbell@circe:~$
But may provide some benefit when removing a large number (30000) of
files (at least empty ones).
cbell@circe:~/test$ time find rm -type f -exec rm {} \;
real 0m48.127s
user 1m32.926s
sys 0m38.750s
cbell@circe:~/test$ time find unlink -type f -exec unlink {} \;
real 0m46.167s
user 1m32.194s
sys 0m39.346s
cbell@circe:~/test$
I suspect that removing a large number of non-zero byte files will be
slower with unlink than rm.
--
Chris
Reply to: