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



## Lifeonfull (Dec 26, 2014)

For a clean system.


----------



## wblock@ (Dec 26, 2014)

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


----------



## Lifeonfull (Dec 26, 2014)

wblock@ said:


> 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.


----------



## ondra_knezour (Dec 27, 2014)

See build(7)

Relevant part

```
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''.
```


----------



## Lifeonfull (Dec 27, 2014)

Thank you! I apologize for not searching on the website documents first before asking.


----------

