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: Apple recommending anti-virus software for Macs?
    ... > To be ultra-safe with the 'rm' command, ... Not a bad idea for root, It would drive me nuts in my user account. ... downloads directory and executing it. ... That I type an EOF is a trivial difference versus 'sudo' exiting ...
    (comp.sys.mac.system)
  • Re: [opensuse] su - -c $command user ???
    ... I'd like to calculate a command-string as root and pass it with su ... into the context of a unprivileged user to run the command not as ... Basically I need to know $d after the daemonuser created and filled ... Note the echo isn't really going to be a fully valuable ...
    (SuSE)
  • 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)