---
name: "clean-old-distfiles"
section: "1"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/clean-old-distfiles"
---

# clean-old-distfiles(1)

remove obsolete ports distfiles

## NAME

**clean-old-distfiles** – remove obsolete ports distfiles

## SYNOPSIS

**clean-old-distfiles** \[**-mnvx**\] \[**-e** *except*\] \[**-h** *history*\] \[*timestamp*\]

## DESCRIPTION

Each time [dpb(1)](/dpb/1.md) is run for a full scan of the [ports(7)](/ports/7.md) tree, it appends to the *history* log, listing files in the *distfiles* directory that are not, or no longer, needed for building the complete tree. It can also be run solely for that purpose, by using:

$ **dpb** **-D** **HISTORY\_ONLY**

When **clean-old-distfiles** is run later, it uses the information from the history log to delete unneeded files. When a file is deleted, the corresponding entry is also deleted from the history log.

By default, **clean-old-distfiles** deletes all files listed in the history log.

If a *timestamp* is given, it is interpreted as a number of seconds since the Epoch, similar to the [date(1)](/date/1.md) **-r** argument, and only those files are deleted that were recorded as obsolete at that time or earlier. It can also be set to a date in ISO8601 format, like ‘2023-07-01’ or ‘2023-07-02T12:00:00Z’.

For normal files, **clean-old-distfiles** verifies [sha256(1)](/sha256/1.md) checksums prior to removal. It also removes links under *by\_cipher/sha256*, but it trusts that the checksums for these are accurate.

Options are as follows:

- **-e** *except*

  Read exception list from file *except*. Each line is the name of a file that shouldn't be removed.

- **-h** *history*

  Read log from history file *history* instead of the default */usr/ports/distfiles/history*. Turns on **-nv**, as this is a testing option.

- **-m**

  Causes **clean-old-distfiles** to display the progress meter even if not on a terminal.

- **-n**

  Don't really remove files.

- **-v**

  Display what will be removed, as ‘rm file’ lines.

- **-x**

  Causes **clean-old-distfiles** to not display the progress meter.

## FILES

- */usr/ports*

  base of the ports tree, can be overridden with env variable PORTSDIR.

- */usr/ports/distfiles*

  location of the distfiles repository, can be overridden with env variable DISTDIR.

- */usr/ports/distfiles/history*

  log of obsolete distfiles.

## SEE ALSO

[dpb(1)](/dpb/1.md), [sha256(1)](/sha256/1.md), [mirroring-ports(7)](/mirroring-ports/7.md)
