Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
function usage() {
(
echo "usage: $0 <auth-token> <group-address> <mbox-dir>"
echo "To generate an auth token go to https://developers.google.com/oauthplayground/ and get an access token for Google Groups migration"
) >&2
exit 5
}
AUTH_TOKEN="$1"
shift
GROUP="$1"
shift
MBOX_DIR="$1"
shift
[ -z "$AUTH_TOKEN" -o -z "$GROUP" -o -z "$MBOX_DIR" ] && usage
for file in $MBOX_DIR/*; do
curl -H"Authorization: Bearer $AUTH_TOKEN" -H'Content-Type: message/rfc822' -X POST \
"https://www.googleapis.com/upload/groups/v1/groups/$GROUP/archive?uploadType=media" --data-binary @${file} || exit 1
done
@miguelperezit

This comment has been minimized.

Copy link

commented Sep 12, 2019

Hi there,

Thanks for this script. I've exported the mbox files correctly (apparently) but when I use your script to import those mbox files I only get this "error" message:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Unable to parse the raw message"
}
],
"code": 400,
"message": "Unable to parse the raw message"
}
}

Is this easy to solve?
Any thoughts?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.