Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!tektronix!tekcrl!terryl From: terryl@tekcrl.LABS.TEK.COM (Terry Laskodi) Newsgroups: comp.unix.questions Subject: Re: Computational complexity of rm & ls Message-ID: <3694@tekcrl.LABS.TEK.COM> Date: 14 Mar 89 10:12:06 GMT References: <9000012@m.cs.uiuc.edu+ <4461@pt.cs.cmu.edu> <1541@zen.UUCP> Reply-To: terryl@tekcrl.LABS.TEK.COM Organization: Tektronix, Inc., Beaverton, OR. Lines: 19 In article <1541@zen.UUCP+ frank@zen.co.uk (Frank Wales) writes: +In article <4461@pt.cs.cmu.edu> marcoz@MARCOZ.BOLTZ.CS.CMU.EDU (Marco Zagha) writes: +>In article <9000012@m.cs.uiuc.edu>, wsmith@m.cs.uiuc.edu writes: +>> [...] "rm *" seems to be a common +>> enough idiom that rm could be optimized to handle that case better. +> +>Don't forget that the shell expands the "*", not rm. All rm sees +>is a huge argv with one name for every file (except .* files). + +This was my first thought upon reading what Bill posted, and then I thought: +"maybe he means the act of deleting all the files in a directory is a +common one, and should be handled specially." Certainly, rm never sees +the '*', only the results of its (sorted, hidden-file-less) expansion. + +Maybe adding a '-A' (for All, harder to type than '-a') option to rm would +be justified. No doubt doing so would break jillions of scripts. :-) There already is an option like that; try "rm -r " (and, yes I know "*" won't match . files....).