Choco: [Feature Request] Auto Remove Old Files

Created on 10 Dec 2017  路  15Comments  路  Source: chocolatey/choco

Can you please get chocolatey to automatically remove old files from C:\ProgramData\chocolatey.chocolatey after a package has been updated.
Thanks

0 - _Triaging

Most helpful comment

Possibly, this issue has been described before. I'd like to see a CLI option that does roughly the same as Homebrew for macOS with brew cleanup, which removes everything, except what is needed for the latest installed version. It removes old installed versions and installers, which may take up a lot of space. I don't know if Chocolatey already does this automatically, but it would be nice to know this.

All 15 comments

Perhaps you could clarify what you mean?

It does this already in some ways, unless the file has been changed in some way

In the .chocolatey directory there seems to be lots of old directory鈥檚, with names and version numbers of packages that I have set chocolatey to check for updates, both the current version and previous versions.

For example:
ChocolateyGUI.0.13.2 ChocolateyGUI.0.15.0 chocolatey-core.extension.1.3.3 chocolatey-core.extension.1.3.1 and more.

Possibly, this issue has been described before. I'd like to see a CLI option that does roughly the same as Homebrew for macOS with brew cleanup, which removes everything, except what is needed for the latest installed version. It removes old installed versions and installers, which may take up a lot of space. I don't know if Chocolatey already does this automatically, but it would be nice to know this.

@erikhuizinga There is choco optimize that does a lot of cleanup and Package Reducer that automatically cleans up packaging. https://chocolatey.org/docs/features-package-reducer

We've also noted #1124 for removing things from the cache.

@zero77 the .chocolatey directory should be ignored, as it is for choco internals and will move likely into a db format at some point.

Yes, moving it into a DB file would be great. Though, for now it would be good if chocolatey could automatically clear .chocolatey of old leftover directories.

Because, each time a package is updated a new directory is created within .chocolatey without the old ones being removed, resulting in a lot of old directories being left behind.

@zero77 the old ones actually have a purpose.

There's also this pending to be approved choco cleaner I wrote :)
https://chocolatey.org/packages/choco-cleaner/0.0.1

@zero77 the old ones actually have a purpose.

@ferventcoder I'm going to guess that when you uninstall a package the old C:\ProgramData\chocolatey.chocolatey\packagename files are used to remove additional files and registry keys that might be left over from older versions of the program but not in the current one?

@ferventcoder ok I understand, its necessary until a DB has been developed.

@bcurran3 Thanks, I will have a look, though is it on github.

@zero77, yes. Can be found via the package source link on the Chocolatey page or directly here: https://github.com/bcurran3/ChocolateyPackages/tree/master/choco-cleaner

Was this page helpful?
0 / 5 - 0 ratings