Last active
February 16, 2016 01:17
-
-
Save oemden/ec0dd2ae745f4e5a23cb to your computer and use it in GitHub Desktop.
Remove corrupted index from IMAP DOVECOT - Os X Server
This file contains 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/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