Skip to content

Instantly share code, notes, and snippets.

@Neo-Oli
Created April 6, 2017 08:53
Show Gist options
  • Save Neo-Oli/15a3a1f8d31035c454231dc6998cfe43 to your computer and use it in GitHub Desktop.
Save Neo-Oli/15a3a1f8d31035c454231dc6998cfe43 to your computer and use it in GitHub Desktop.
email backup resore
#creating maildir
cd ~/drive/mail
mkdir ~/mail
#creating directories in maildir
for dir in `find -type d`;do
if [ "$dir" != "." ];then
mkdir "$HOME/mail/$dir"
fi
done
#copying mails, replacing the backup string with colon
echo "copying $(find|wc -l) items"
for file in `find -type f`;do
newfile=${file/"%%%%%"/":"}
cp "$HOME/drive/mail/$file" "$HOME/mail/$newfile"
echo $file;
done|pv -ls $(find|wc -l) - >/dev/null
cd $BASEDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment