Skip to content

Instantly share code, notes, and snippets.

@gustavomdsantos
Last active May 23, 2018 14:53
Show Gist options
  • Save gustavomdsantos/017738fe35f26e70e712bdbcee6293f5 to your computer and use it in GitHub Desktop.
Save gustavomdsantos/017738fe35f26e70e712bdbcee6293f5 to your computer and use it in GitHub Desktop.
Shell script to clean old dependencies from Maven repositories in Linux computers. Downloaded dependencies for more than 30 days is deleted. Code based on: http://stackoverflow.com/a/29970448
#!/usr/bin/env bash
find ~/.m2 -atime +30 -iname '*.pom' | while read pom; do parent=`dirname "$pom"`; rm -Rf "$parent"; done;
find ~/.m2 -empty -type d -delete;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment