Last active
August 28, 2022 21:46
-
-
Save alber-khan/0adbcbfb1f9aa12c0554513e147bd250 to your computer and use it in GitHub Desktop.
Dovecot to unzip all emails
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/bash | |
mailfixafterimport () { | |
gunzip -S "0" * | |
gunzip -S "1" * | |
gunzip -S "2" * | |
gunzip -S "3" * | |
gunzip -S "4" * | |
gunzip -S "5" * | |
gunzip -S "6" * | |
gunzip -S "7" * | |
gunzip -S "8" * | |
gunzip -S "9" * | |
gunzip -f -S "0" * | |
gunzip -f -S "1" * | |
gunzip -f -S "2" * | |
gunzip -f -S "3" * | |
gunzip -f -S "4" * | |
gunzip -f -S "5" * | |
gunzip -f -S "6" * | |
gunzip -f -S "7" * | |
gunzip -f -S "8" * | |
gunzip -f -S "9" * | |
gunzip -S "Sa" * | |
gunzip -S "S" * | |
gunzip -S "2," * | |
gunzip -S "a" * | |
gunzip -f -S "Sa" * | |
gunzip -f -S "S" * | |
gunzip -f -S "2," * | |
gunzip -f -S "a" * | |
} | |
for d in * .[^.]*; do | |
if [ -d "$d" ]; then | |
# Will not run if no directories are available | |
# echo "$f" | |
if [[ "$d" == *.* ]]; then | |
# Will not run if no directories are available | |
echo "///////////////////////////" | |
echo "$PWD/$d" | |
echo "///////////////////////////" | |
for cur in "$PWD/$d/cur"; do | |
$(cd $cur && mailfixafterimport) | |
# echo $cur | |
done | |
for new in "$PWD/$d/new"; do | |
$(cd $new && mailfixafterimport) | |
# echo $new | |
done | |
for tmp in "$PWD/$d/tmp"; do | |
$(cd $tmp && mailfixafterimport) | |
# echo $tmp | |
done | |
echo "///////////////////////////" | |
else | |
$(cd "$PWD/$d/" && mailfixafterimport) | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just need to go to
/home/'user'/mail/'domain.com'/'emailfolder'
'user' = your panel username
'domain.com' = your domain name
'emailfolder' = your email id folder
also
chown -hR user:mail
support/ (note: replace ‘user’ with your username.)