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



Ben Bacarisse <spam@xxxxxxxxx> wrote:
ewaguespack@xxxxxxxxx wrote:
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 was taking ages, so on a hunch I decided to try this to see it I
got any better results:

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

I smell a rat. What an odd command to post! For one thing, it does
not do the same as the find above and, secondly, a single rm would
surely be faster still?

With luck, no one will have tried either command out!

I tried out both commands. In a test directory made for just such a
purpose, of course. Sheesh. You'd think the part about "remove several
thousand...files" as well as the "rm" and "unlink" showing up in all their
undisguised glory would be a pretty good tip off that one should not try
then in root and as root.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: System-users and-groups?
    ... bin shouldn't do so much. ... was root and bin... ... Although the daemon user/group are ... as that user runs that command. ...
    (alt.linux)
  • RE: remote ssh for root
    ... forced-commands-only option set, you have to have the command option set. ... execution as root. ... > This message contains confidential information and is ...
    (SSH)
  • Re: grub menu oddity
    ... >>> command (until the manual root command was executed). ... >>> When I first encountered this behavior, it took several reboots for me to ... FWIW - a new CMOS battery is only $3-5 at your local Shaque du Radio ...
    (comp.os.linux.setup)
  • Re: [PHP] strange errors from command line vs. web
    ... standard php. ... > can't run the script from the command line even when I su to root. ... >>> I have some code that makes a connection to the db. ...
    (php.general)
  • Re: SU privileges
    ... If you know a userid you want to limit the ability to su too (like root), ... Another way would be to set an ACL on the su command. ... If you have received this electronic transmission in error, please notify the sender immediately by a "reply to sender only" message and destroy all electronic and hard copies of the communication, including attachments. ...
    (AIX-L)