Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!intelca!mipos3!omepd!merlyn From: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.unix.questions Subject: cleaning a directory (was Re: Computational complexity of rm & ls) Summary: trying another tactic Message-ID: <4218@omepd.UUCP> Date: 14 Mar 89 20:36:27 GMT References: <9000012@m.cs.uiuc.edu> <4461@pt.cs.cmu.edu> <1541@zen.UUCP> <871@Portia.Stanford.EDU> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 30 In-reply-to: karish@forel.stanford.edu (Chuck Karish) In article <871@Portia.Stanford.EDU>, karish@forel (Chuck Karish) writes: | Great, another feature! How about using an alias instead: | | alias rmall 'ls -f | xargs rm -f' | | This avoids the overhead of sorting the names in the directory. | It also suppresses those annoying queries from rm. If the intent was to clean out a directory (and the directory itself can be sacrificed and recreated), why not let 'rm' locate the files itself, as in: $deadmeat=`pwd` cd / rm -rf $deadmeat mkdir $deadmeat chmod $someprotection $deadmeat No big deal. No passing of arguments to rm, and no need to worry about .* files and files containing spaces and returns (yup, it's pathological, but I worry sometimes...). A certified UN*X Guru (Guru card #777)... -- Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 on contract to BiiN (for now :-), Hillsboro, Oregon, USA. ARPA: <@intel-iwarp.arpa:merlyn@intelob> (fastest!) MX-Internet: UUCP: ...[!uunet]!tektronix!biin!merlyn Standard disclaimer: I *am* my employer! Cute quote: "Welcome to Oregon... home of the California Raisins!"