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

Re: the ~ files



Quoting Adam Shand (larry@alaska.net):
> 
> > But if I don't mistake, theire is a lot of software that add a ~ after a
> > backup file. So I would like to know if there is a way do delete in one
> > commande with secure way.
> 
> when i'm not sure if the rm command i'm going to run is the one i actually
> want i do this:
> 
> # ls ~*
> 
> and then if the list of files i get is what i actually want i run the rm
> command (as other have warned be careful not to get a space in there by
> mistake).
> 
> also if you're really not sure or if you want to delete all of the ~*
> commands but a couple of them you can do this:
> 
> # rm -i ~*
> 
> which will prompt you with a yes/no option before it deletes each file.
> 
> adam.

It's certainly just as well to check things out if you're going to type
~* instead of *~ !

One approach, which I use, is to insert into .bashrc (edit to taste):

function cleanup
{
    find . -name "*~" -exec rm -i {} \;
    find . -name ".*~" -exec rm -i {} \;
    find . -name "#*#" -exec rm -i {} \;
    find . -name core -exec rm -i {} \;
}

You could expand it to include all the dross that TeX leaves behind, etc.

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.


Reply to: