Re: why is perl -e 'unlink(glob("*"))' so much faster than rm ?



At 2006-07-17 11:25AM, A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx> wrote:
ewaguespack@xxxxxxxxx wrote in news:1153149395.583924.157680@
35g2000cwc.googlegroups.com:

i had a situation that required that i remove several thousand zero
byte files, and i tried this first:

# find . -type f -exec rm -f {} \;

This executes rm separately for each file found.

Additionally, 'find' is descending into subdirectories.

this was taking ages, so on a hunch I decided to try this to see it I
got any better results:

# perl -e 'unlink(glob("*"))'

surprisingly the perl unlink took about a quarter of a second to remove
1000 files versus 30 seconds with find / rm

How about

rm -f *

These solutions look in the current directory only.

--
Glenn Jackman
Ulterior Designer
.