cleaning a directory (was Re: Computational complexity of rm & ls)
Randal L. Schwartz @ Stonehenge
merlyn at intelob.intel.com
Wed Mar 15 06:36:27 AEST 1989
In article <871 at Portia.Stanford.EDU>, karish at 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 at intelob> (fastest!)
MX-Internet: <merlyn at intelob.intel.com> UUCP: ...[!uunet]!tektronix!biin!merlyn
Standard disclaimer: I *am* my employer!
Cute quote: "Welcome to Oregon... home of the California Raisins!"
More information about the Comp.unix.questions
mailing list