On Sun, Oct 26, 2003 at 07:46:05PM +0100, David Jardine wrote: > On Sun, Oct 26, 2003 at 10:12:18AM -0500, Bijan Soleymani wrote: > > On Sun, Oct 26, 2003 at 02:10:01PM +0000, Karsten M. Self wrote: > > > on Fri, Oct 24, 2003 at 03:28:36PM +0100, Colin Watson ([EMAIL PROTECTED]) wrote: > > > > On Fri, Oct 24, 2003 at 11:36:25PM +0930, David Purton wrote: > > > > > > > > Sadly no, I neglected to say that I could not get things to work even > > > > > using a test account and doing an rm -rf .* in $HOME. > > > > > > > > Just in case other people try this, 'rm -rf .*' is VERY DANGEROUS. '.*' > > > > expands to include '.' and '..', and if you happen to have privileges to > > > > write to the parent directory then you'll end up removing all > > > > directories *next* to your current directory as well! > > > > > > So what do folks do? > > > > > > rm -rf .?* # will expand to include .. > > > > > > rm -rf .[^.]* # seems right. > > > > > > find . -depth -print0 | xargs rm # Usually works. > > > > > > If you're really paranoid: > > > > > > chown -r peon . > > > su -c 'rm -rf .' peon > > > > > > ...which first changes ownership to a nonprivileged user, then runs the > > > rm as that user. Keeps you from mucking things up in a rootly way. > > > > > > Personally I tend to walk through trees very carefully when doing > > > deletes. > > > > > > > > > Other tips? > > > > You could always do: > > rm -r `ls -A` > > > > ls -A lists all files except "." and "..". From the ls manpage: > > > > "-A, --almost-all > > do not list implied . and .." > > > > Not to be confused with "ls -a" which does list "." and "..". > > Then wouldn't > > rm -r `ls` > > do the trick?
Except that ls doesn't list any files *beginning* with a dot. ls -a list all files ls -A list all files minus "." and "..". Bijan -- Bijan Soleymani <[EMAIL PROTECTED]> http://www.crasseux.com
signature.asc
Description: Digital signature