annotate moz-script @ 7:3e3d8b576630

changes to look for duplicates
author carl
date Thu, 23 Dec 2004 13:38:01 -0800
parents fac01758bd41
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
fac01758bd41 Initial revision
carl
parents:
diff changeset
1 #!/bin/bash
fac01758bd41 Initial revision
carl
parents:
diff changeset
2
fac01758bd41 Initial revision
carl
parents:
diff changeset
3 # Helper script to convert to Mozilla mail format
fac01758bd41 Initial revision
carl
parents:
diff changeset
4 # Author: David Binard <binard@users.sf.net>
fac01758bd41 Initial revision
carl
parents:
diff changeset
5
fac01758bd41 Initial revision
carl
parents:
diff changeset
6 # Taken from: <http://sourceforge.net/tracker/index.php?func=detail&aid=938792&group_id=18756&atid=318756>
fac01758bd41 Initial revision
carl
parents:
diff changeset
7 # Note: this assumes readpst was run with the -r
fac01758bd41 Initial revision
carl
parents:
diff changeset
8 # (recursive) option.
fac01758bd41 Initial revision
carl
parents:
diff changeset
9
fac01758bd41 Initial revision
carl
parents:
diff changeset
10
fac01758bd41 Initial revision
carl
parents:
diff changeset
11 if [ "$#" != 1 ]; then
fac01758bd41 Initial revision
carl
parents:
diff changeset
12 echo "Usage: `basename $0` <folder>"
fac01758bd41 Initial revision
carl
parents:
diff changeset
13 exit 1
fac01758bd41 Initial revision
carl
parents:
diff changeset
14 fi
fac01758bd41 Initial revision
carl
parents:
diff changeset
15
fac01758bd41 Initial revision
carl
parents:
diff changeset
16 process_dir() {
fac01758bd41 Initial revision
carl
parents:
diff changeset
17 echo Processing directory "$1"
fac01758bd41 Initial revision
carl
parents:
diff changeset
18 for item in "$1/"*; do
fac01758bd41 Initial revision
carl
parents:
diff changeset
19 if [ -d "$item" ]; then
fac01758bd41 Initial revision
carl
parents:
diff changeset
20 mv "$item" "$item.sbd"
fac01758bd41 Initial revision
carl
parents:
diff changeset
21 touch "$item"
fac01758bd41 Initial revision
carl
parents:
diff changeset
22 process_dir "$item.sbd"
fac01758bd41 Initial revision
carl
parents:
diff changeset
23 elif [ "`basename \"$item\"`" = mbox ]; then
fac01758bd41 Initial revision
carl
parents:
diff changeset
24 mv "$item" "${item%%.sbd/mbox}"
fac01758bd41 Initial revision
carl
parents:
diff changeset
25 else
fac01758bd41 Initial revision
carl
parents:
diff changeset
26 echo ERROR: invalid item "$item"
fac01758bd41 Initial revision
carl
parents:
diff changeset
27 exit 1
fac01758bd41 Initial revision
carl
parents:
diff changeset
28 fi
fac01758bd41 Initial revision
carl
parents:
diff changeset
29 done
fac01758bd41 Initial revision
carl
parents:
diff changeset
30 }
fac01758bd41 Initial revision
carl
parents:
diff changeset
31
fac01758bd41 Initial revision
carl
parents:
diff changeset
32 item="$1"
fac01758bd41 Initial revision
carl
parents:
diff changeset
33 mv "$item" "$item.sbd"
fac01758bd41 Initial revision
carl
parents:
diff changeset
34 touch "$item"
fac01758bd41 Initial revision
carl
parents:
diff changeset
35 process_dir "$item.sbd"
fac01758bd41 Initial revision
carl
parents:
diff changeset
36