view contrib/moz-script @ 390:5c0ce43c7532

Fix a number of spelling mistakes Changes-by: codespell -w Suggested-by: codespell, spellintian, lintian I: libpst4: spelling-error-in-binary usr/lib/x86_64-linux-gnu/libpst.so.4.1.14 occured occurred I: libpst-dev: spelling-error-in-manpage usr/share/man/man5/outlook.pst.5.gz Attachement Attachment
author Paul Wise <pabs3@bonedaddy.net>
date Sat, 21 Dec 2019 21:25:45 +0800
parents c508ee15dfca
children
line wrap: on
line source

#!/bin/bash

# Helper script to convert to Mozilla mail format
# Author: David Binard <binard@users.sf.net>

# Taken from:  <http://sourceforge.net/tracker/index.php?func=detail&aid=938792&group_id=18756&atid=318756>
# Note: this assumes readpst was run with the -r
# (recursive) option.


if [ "$#" != 1 ]; then
	echo "Usage: `basename $0` <folder>"
	exit 1
fi

process_dir() {
	echo Processing directory "$1"
	for item in "$1/"*; do
		if [ -d "$item" ]; then
			mv "$item" "$item.sbd"
			touch "$item"
			process_dir "$item.sbd"
		elif [ "`basename \"$item\"`" = mbox ]; then
			mv "$item" "${item%%.sbd/mbox}"
		else
			echo ERROR: invalid item "$item"
			exit 1
		fi
	done
}

item="$1"
mv "$item" "$item.sbd"
touch "$item"
process_dir "$item.sbd"