Skip to content

Instantly share code, notes, and snippets.

@koppor
Created December 6, 2015 14:08
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 koppor/afbac4d7dc6b4f9885fb to your computer and use it in GitHub Desktop.
Save koppor/afbac4d7dc6b4f9885fb to your computer and use it in GitHub Desktop.
Delete old builds at http://builds.jabref.org
#!/bin/bash
cd /var/www/builds.jabref.org/www/
# delete all branches not touched for the last 90 days
# see http://stackoverflow.com/a/19873824/873282
#find . -mindepth 1 -maxdepth 1 -type d -mtime +90 ! -path "./_h5ai" ! -path "./master" -exec rm {} \;
# delete files in the remaining directories
# see http://stackoverflow.com/a/13525005/873282
for path in `find . -mindepth 1 -maxdepth 1 -type d ! -path "./_h5ai"`; do
cd $path
# echo $path
# see http://stackoverflow.com/a/4561987/873282 and http://stackoverflow.com/a/17850033/873282
# 3 files in the NSIS case, 4 files in the install4j case
# kgV is 12
for file in `find . -type f -printf '%T@ %p\n' | sort -n | tail -n+12 | cut -f2- -d" "`; do
rm $file
done
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment