Skip to content

Instantly share code, notes, and snippets.

@oemden
Last active February 16, 2016 01:17
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 oemden/ec0dd2ae745f4e5a23cb to your computer and use it in GitHub Desktop.
Save oemden/ec0dd2ae745f4e5a23cb to your computer and use it in GitHub Desktop.
Remove corrupted index from IMAP DOVECOT - Os X Server
#!/bin/bash
#
## © oem at oemden dot com
## remove corrupted index from IMAP DOVECOT (Os X Server)
## usage : path/to/RemoveBadIndexDovecot.sh PATH/TO/UUID-FOLDER-OF-SOME-USER
#$1 target dir
clear
###add sudo_check
if [[ ! "$1" ]] ; then
echo "no target folder, exiting"
echo "## usage : path/to/RemoveBadIndexDovecot.sh PATH/TO/UUID-FOLDER-OF-SOME-USER"
exit
fi
targetFolder="$1"
theFolder=$(basename "$1")
pathFodler=$(dirname "$1")
FILELIST=(
"dovecot.index"
"dovecot.index.cache"
"dovecot.index.log"
)
echo "-------------------------------"
echo "targetFolder: $targetFolder"
echo "theFolder: $theFolder"
echo "pathFodler: $pathFodler"
echo "-------------------------------"
function removeindex {
cd "$targetFolder"
pwd
for f in "${FILELIST[@]}"
do
echo "$f"
find ./ -name "$f" -exec rm -rf {} \;
done
#find . -name "*.pyc" -exec rm -rf {} \;
}
removeindex
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment