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

Re: Cleaning out old backup (*~, *.bak) files



On Sat, Dec 24, 2005 at 01:52:44AM -0600, a.list.address@gmail.com wrote:
> I have a lot of *~ and *.bak files in my home directories, including
> recent ones, and ones from several years ago.  I'd like to set up a
> good system that gets rid of old ones--say, older than a month.  I also
> would like them to go to the KDE trash bin.

Saving files in a trash bin...  Maybe it's just me, but this doesn't
sound good.  If it's in the trash bin it is trash and it should be
trashed, that is: thrown away.  Apparently you are concerned about
losing these files.  Just do a 'mkdir ~/my-previous-backups/' and move
them there.  But suit yourself. :)

> Anyway, I'm posting to see what other Debianites do to clean out their
> old, unneeded files; what kinds of scripts, etc.  Any general
> suggestions?

The 'find' program can be a big help here.  The following line removes
all files in the current dir (and all subdirs) that end with '~':

find . -name '*~' | xargs rm

This finds all files in the current dir (and all subdirs) that end
with ',bak' and haven't been changed in the last 30 days:

find . -name '*.bak' -ctime +30

Read the man or info file for find to get more ideas.

HTH,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
       GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

Attachment: signature.asc
Description: Digital signature


Reply to: