docs/content/en/reference/references/mesheryctl/registry/purge.md
Prune old model version directories
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'> mesheryctl registry purge [flags] </div> </pre>Retain only the latest version of every model (default).
<pre class='codeblock-pre'> <div class='codeblock'> mesheryctl registry purge </div> </pre>Retain the 3 most recent versions of every model.
<pre class='codeblock-pre'> <div class='codeblock'> mesheryctl registry purge --retain 3 </div> </pre>Preview what would be removed without deleting anything.
<pre class='codeblock-pre'> <div class='codeblock'> mesheryctl registry purge --dry-run </div> </pre>Additionally skip specific models.
<pre class='codeblock-pre'> <div class='codeblock'> mesheryctl registry purge --exclude aws-ec2-controller,cilium </div> </pre>Skip the confirmation prompt.
<pre class='codeblock-pre'> <div class='codeblock'> mesheryctl registry purge --retain 2 -y </div> </pre>Go back to [command reference index]({{< ref "reference/references/mesheryctl/_index.md" >}}), if you want to add content manually to the CLI documentation, please refer to the [instruction]({{< ref "project/contributing/cli/cli.md#preserving-manually-added-documentation" >}}) for guidance.