Interactive 2.2 File zapper.

David Rector drector at orion.oac.uci.edu
Mon Jul 30 15:42:54 AEST 1990


In <11 at raysnec.UUCP> shwake at raysnec.UUCP (Ray Shwake) writes:

>jrh at mustang.dell.com (James Howard) writes:

>>touch /lost+found
>>find /lost+found -mtime +14 -exec rm -rf {} \; >/dev/null 2>&1

>	... except that touch will create a FILE if the entity does not
>	already exist. Better to do something like:

>	if [ -d /lost+found ]; do
>		find ....
>	fi

Sorry, this doesn't work either.  It has the same bug as 2.0.2; it will
delete lost+found.  Howard's fix will work if lost+found exists.  If
you want to be absolutely sure use something like

        if [ -d /lost+found ]; do
                touch /lost+found
                find ...
        else
                mkdir /lost+found
        fi

This, of course, would also fail if /lost+found exists as a file.
The pedantic may decorate the above accordingly.

David Rector                         drector at orion.uci.edu
Dept. of Math.                       U. C. Irvine, Irvine CA 92717

-- 
David L. Rector



More information about the Comp.unix.i386 mailing list