LinuxCommandLibrary

dvc-destroy

Remove DVC tracked data and metadata

TLDR

Destroy the current project

$ dvc destroy
copy

Force destroy the current project
$ dvc destroy [[-f|--force]]
copy

SYNOPSIS

dvc destroy [-h | --help] [-v | --verbose] [-q | --quiet] [--cd DIR] [-f | --force] [TARGETS ...]

PARAMETERS

-h, --help
    Show help message and exit.

-v, --verbose
    Increase verbosity of output logs.

-q, --quiet
    Suppress non-error output.

--cd DIR
    Change to directory DIR before execution.

-f, --force
    Skip confirmation prompt before destroying.

TARGETS
    Paths to data artifacts (.dvc files), directories, or 'all' to target everything.

DESCRIPTION

The dvc destroy command permanently removes DVC-tracked data artifacts and models from the local cache directory, freeing up disk space. It targets specific files, directories, or all unused cache objects. Unlike dvc gc, it does not consider workspace usage and deletes unconditionally.

By default, it prompts for confirmation to prevent accidental data loss. Use --force to skip this. Targets can be .dvc files, output paths, or the special keyword all. Destruction only affects the cache; metadata files like .dvc remain intact, allowing data recovery via dvc pull from remotes.

Best practice: Run dvc push first to back up data remotely. This command is essential for managing large datasets in ML pipelines, preventing cache bloat over time.

CAVEATS

Destruction is irreversible locally; always dvc push first. Does not remove .dvc metadata or workspace files.

EXAMPLES

dvc destroy all - Destroy all cache objects.
dvc destroy data/model.pkl.dvc - Target specific artifact.
dvc destroy --force '*.pkl.dvc' - Force destroy matching patterns.

CACHE LOCATION

Cache defaults to .dvc/cache; use dvc cache dir to verify.

HISTORY

Introduced in DVC v1.0 (2020) as part of cache management enhancements; evolved from earlier collect and manual cleanup workflows.

SEE ALSO

dvc gc(1), dvc push(1), dvc pull(1), dvc cache(1)

Copied to clipboard