RFC: automated way of removing old base system files (only for a recent 6-current!)

Giorgos Keramidas keramida at freebsd.org
Sun Oct 24 16:05:12 PDT 2004

On 2004-10-24 09:38, "Jason C. Wells" <jcw at highperformance.net> wrote:
> I realize that I am a bit of a late comer to this discussion.  I use this
> method to remove old files.  You guys might gasp in horror, but it seems to
> work.  The actual script is a bit longer.  I do this on RELENG_5 but that
> shouldn't matter.
> # make buildworld
> # touch time_marker
> # make installworld
> # find $dir \! -path $includes_and_others \! -type d \! -newer time_marker
> -exec rm {} \;
> I only recently started doing this on a system that I mostly compile
> software on.  I did end up having to remake a port that was linked to a
> library that was deleted.  That's no biggy on a hobby box.
> My motivation was to delete items that I had NO_* (bind, sendmail) options
> for in make.conf.

I use something similar here.  I run find on specific directories and
use the -x option though with -mtime:

	# make installworld
	# find / -x -mtime 1h > /tmp/files.root
	# find /var -x -mtime 1h > /tmp/files.var
	# find /usr -x -mtime 1h > /tmp/files.var

Then I manually skim through the lists and see if I want to keep
something listed in there.  Eventually, I delete the obsolete files
with something like:

	# for filelist in /tmp/files.* ;do
	      xargs chflags noschg < ${filelist}
	      xargs rm -fr < ${filelist}

More information about the freebsd-current mailing list