# mesheryctl-registry-purge

LLMS index: [llms.txt](/llms.txt)

---

# mesheryctl registry purge

Prune old model version directories

## Synopsis

Prune older versions of Meshery Models under ./models, retaining only the most recent --retain versions of each model.

Prerequisite: Execute this command from the root of a meshery/meshery repo fork; it operates on the "./models" directory relative to the current working directory.

The "kubernetes" and "meshery-core" models are always excluded from purging, regardless of flags. Use --exclude to skip additional models.

<pre class='codeblock-pre'>
<div class='codeblock'>
<div class='clipboardjs'>
mesheryctl registry purge [flags]

</div>
</div>
</pre> 

## Examples

Retain only the latest version of every model (default).
<pre class='codeblock-pre'>
<div class='codeblock'>
<div class='clipboardjs'>
mesheryctl registry purge

</div>
</div>
</pre> 

Retain the 3 most recent versions of every model.
<pre class='codeblock-pre'>
<div class='codeblock'>
<div class='clipboardjs'>
mesheryctl registry purge --retain 3

</div>
</div>
</pre> 

Preview what would be removed without deleting anything.
<pre class='codeblock-pre'>
<div class='codeblock'>
<div class='clipboardjs'>
mesheryctl registry purge --dry-run

</div>
</div>
</pre> 

Additionally skip specific models.
<pre class='codeblock-pre'>
<div class='codeblock'>
<div class='clipboardjs'>
mesheryctl registry purge --exclude aws-ec2-controller,cilium

</div>
</div>
</pre> 

Skip the confirmation prompt.
<pre class='codeblock-pre'>
<div class='codeblock'>
<div class='clipboardjs'>
mesheryctl registry purge --retain 2 -y

</div>
</div>
</pre> 

## Options

<pre class='codeblock-pre'>
<div class='codeblock'>
      --dry-run          print what would be removed without deleting anything
      --exclude string   comma-delimited list of additional model names to exclude from purging
  -h, --help             help for purge
      --retain int       number of most-recent versions to retain per model (default 1)
  -y, --yes              (optional) assume yes for user interactive prompts.

</div>
</pre>

## Options inherited from parent commands

<pre class='codeblock-pre'>
<div class='codeblock'>
      --config string   path to config file (default "~/.meshery/config.yaml")
  -v, --verbose         verbose output

</div>
</pre>

## See Also

Go back to [command reference index](/reference/mesheryctl/), if you want to add content manually to the CLI documentation, please refer to the [instruction](/project/contributing/cli/cli/#documenting) for guidance.
