Computational complexity of rm & ls
Terry Laskodi
terryl at tekcrl.LABS.TEK.COM
Tue Mar 14 20:12:06 AEST 1989
In article <1541 at zen.UUCP+ frank at zen.co.uk (Frank Wales) writes:
+In article <4461 at pt.cs.cmu.edu> marcoz at MARCOZ.BOLTZ.CS.CMU.EDU (Marco Zagha) writes:
+>In article <9000012 at m.cs.uiuc.edu>, wsmith at 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 <directory-name>"
(and, yes I know "*" won't match . files....).
More information about the Comp.unix.questions
mailing list