[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rm -rf .* alternatives



>>>>> "Karsten" == Karsten M Self <kmself@ix.netcom.com> writes:

    Karsten> on Fri, Oct 24, 2003 at 03:28:36PM +0100, Colin Watson
    Karsten> (cjwatson@debian.org) 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!

    Karsten> So what do folks do?

    Karsten> rm -rf .?* # will expand to include ..

    Karsten> rm -rf .[^.]* # seems right.

mkdir temp
# Add * to the following if one would like to nuke everything
mv .* temp
# Check to see whether temp contain anything wrong
\rm -rf temp

Regards,
Isaac.



Reply to: