removing a directory 300g in size

What is fastest way on FreeBSD?
rm -rf
find dir -exec rm -rf {} \;
or maybe find dir -exec echo '' > {} \;
?
I tried first 2 in order on zfs folder.....seemed kinda slow.
 
Last edited by a moderator:
Assuming that the directory has a sane number of files in it (thousands or tens of thousands, not dozens of millions or billions), the cost of delete will be dominated by internal file system operations. So the userspace stuff probably makes no difference, and I would use "rm -rf" for simplicity.

If the directory tree has many millions or billions of files ... then you need to seek professional help. That's deliberately a double entendre: People who put that many files are either very stupid, very crazy, or very smart. And optimizing file system operations at that scale is real work, nothing you do in a few minutes on a discussion forum.
 
Back
Top