Forked from cescoffier/cleanup_maven_repository.sh
Last active
December 28, 2015 23:29
-
-
Save masih/7579544 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
M2_REPO=${HOME}/.m2 | |
OLDFILES=/tmp/deleted_artifacts.txt | |
AGE=195 | |
echo "==== To be Deleted Jars ====" >> ${OLDFILES} | |
find "${M2_REPO}" -path '*SNAPSHOT*' -name '*jar' -type f -atime +${AGE} >> ${OLDFILES} | |
echo "==== To be Deleted Wars/Ears ====" >> ${OLDFILES} | |
find "${M2_REPO}" -path '*SNAPSHOT*' -name '*war' -type f -atime +${AGE} >> ${OLDFILES} | |
find "${M2_REPO}" -path '*SNAPSHOT*' -name '*ear' -type f -atime +${AGE} >> ${OLDFILES} | |
echo "==== To be Deleted APKs ====" >> ${OLDFILES} | |
find "${M2_REPO}" -path '*SNAPSHOT*' -name '*apk' -type f -atime +${AGE} >> ${OLDFILES} | |
find "${M2_REPO}" -path '*SNAPSHOT*' -name '*apksources' -type f -atime +${AGE} >> ${OLDFILES} | |
find "${M2_REPO}" -path '*SNAPSHOT*' -name '*apklib' -type f -atime +${AGE} >> ${OLDFILES} | |
echo "==== Empty Directories ====" >> ${OLDFILES} | |
find "${M2_REPO}" -type d -empty >> ${OLDFILES} | |
for x in `cat ${OLDFILES}`; do rm -rf "$x"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment