Skip to content

Instantly share code, notes, and snippets.

@pbroschwitz
Created June 13, 2012 08:43
Show Gist options
  • Save pbroschwitz/2922859 to your computer and use it in GitHub Desktop.
Save pbroschwitz/2922859 to your computer and use it in GitHub Desktop.
Clean cache directories
#!/usr/bin/env bash
#SCRIPT_PATH="$(readlink -f $0)"
#SCRIPT_DIR="$(dirname ${SCRIPT_PATH})"
SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)"
function deleteIfExisting {
local dirToDel="${SCRIPT_DIR}/${1}"
if [[ -w "${dirToDel}" ]] ; then
echo "Deleting '${dirToDel}' ..."
#ls -al "${dirToDel}"
rm -r "${dirToDel}";
mkdir "${dirToDel}";
chmod 777 "${dirToDel}";
#ls -al "${dirToDel}"
fi
}
deleteIfExisting "_htdocs/cms/cache/images"
deleteIfExisting "_htdocs/cms/cache/smarty/templates_c"
deleteIfExisting "_htdocs/cms/cache/strings"
deleteIfExisting "_htdocs/cms/inc/compiled"
deleteIfExisting "_htdocs/asset/global/compiled"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment