How could I build world and kernel and delete all the files that weren't created during the builds?

Please expand on what you are asking. Do you mean "how can obsolete system files be deleted?"

Kinda, I guess. What I mean is that I want all the old files to be deleted. It seems like build world does this, but I hear it isn't recommended. To elaborate, after rebuilding world, I only want the files and modules of the new world, and nothing of the world I build the new world on.
 
See build(7)

Relevant part
Code:
Convenience targets for cleaning up the install destination directory
denoted by variable DESTDIR include:

check-old Print a list of old files and directories in the system.

delete-old Delete obsolete base system files and directories inter-
actively. When -DBATCH_DELETE_OLD_FILES is specified at
the command line, the delete operation will be non-
interactive. The variables DESTDIR, TARGET_ARCH and
TARGET should be set as with ``make installworld''.

delete-old-libs Delete obsolete base system libraries interactively.
This target should only be used if no 3rd party software
uses these libraries. When -DBATCH_DELETE_OLD_FILES is
specified at the command line, the delete operation will
be non-interactive. The variables DESTDIR, TARGET_ARCH
and TARGET should be set as with ``make installworld''.
 
Back
Top