Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created May 14, 2021 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/960bc28798a31cbd802b1723683bec46 to your computer and use it in GitHub Desktop.
Save rtrouton/960bc28798a31cbd802b1723683bec46 to your computer and use it in GitHub Desktop.
801.clean-autopkg-repo script, used to remove files older than a specified date from the AutoPkg cache
#!/bin/bash
# Remove AutoPkg-downloaded files older than a specified number of days
# Add username of the account used to run AutoPkg
autopkg_username="autopkg"
# Age of files to retain. For example, setting the following number
# will delete anything older than 20 days
#
# autopkg_cache_age="20"
autopkg_cache_age="20"
/usr/bin/find "/Users/$autopkg_username/Library/AutoPkg/Cache" -mindepth 1 -mtime +"$autopkg_cache_age" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment