From owner-freebsd-questions Thu Sep 12 7:41:53 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EEF0B37B400 for ; Thu, 12 Sep 2002 07:41:49 -0700 (PDT) Received: from otter.mills-atl.com (dsl-64-192-140-77.telocity.com [64.192.140.77]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B3CE43E3B for ; Thu, 12 Sep 2002 07:41:49 -0700 (PDT) (envelope-from jmmills@telocity.com) Received: from localhost (jmills@localhost) by otter.mills-atl.com (8.9.3/8.9.3) with ESMTP id KAA04345; Thu, 12 Sep 2002 10:48:21 -0400 X-Authentication-Warning: otter.mills-atl.com: jmills owned process doing -bs Date: Thu, 12 Sep 2002 10:48:21 -0400 (EDT) From: John Mills X-Sender: jmills@otter.mills-atl.com Reply-To: John Mills To: "Riley J. McIntire" Cc: John Mills , Beech Rintoul , FreeBSD Questions Subject: RE: Can't delete a directory In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Riley, All- Here's another suicidal approach: On Wed, 11 Sep 2002, Riley J. McIntire wrote: after I babbled: > > How about: > > [ ]$ rm -rf > root@wimp:obj# rm -rf usr/ > rm: usr/fsck_msdosfs: Directory not empty > rm: usr/: Directory not empty > root@wimp:obj# Sorry - I came in late on this. Even as root! Is this behavior limited to DOS directories? You could try a script or alias to the general effect of: -+-+-+-+-+-+-+-+-+-+-+-+- slashwrist -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- #!/bin/sh # sorry - I'm a bash weenie. if [ $# -lt 1 ] then echo "usage: slashwrist " echo " and be _really_ careful, Boss!" exit else for FILENAME in `find $1 ! -type d -print` do # consider interactive use here: 'rm -i $FILENAME' echo "Removing "$FILENAME rm -f $FILENAME done echo "Removing directories below "$1 rm -rf $1 fi -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- You may have to run that as root, too, depending on permissions associated with DOS directories. DISCLAIMERS: 1) There is pretty much no limit to the damage you could do your system with this script. 2) I just typed that out by way of example, and tried it only once in FreeBSD. It may well contain errors, or constructs that work differently than I expected. If you try it, _first_ comment out the 'rm' lines, then run it and carefully read the list of files which would have gone to the bit-bucket before you fire off a 'killer' version! If you get the idea I'm a bit cautious about this, you get full credit on the quiz. I would almost prefer to do it manually. I once wiped out my Linux box's '/var' in a moment of emotion with a simple 'rm' at the wrong spot - the emotions which followed were _much_ stronger!! Recovery took quite a while and ultimately a lot of rebuilding. YMMdefinitelyV! - John Mills To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message