File: combine.sh

package info (click to toggle)
pronto 2.2.6-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,892 kB
  • ctags: 406
  • sloc: perl: 21,215; makefile: 145; sh: 34
file content (34 lines) | stat: -rwxr-xr-x 1,346 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# This script converts the directory/file structure of how cscmail used 
# to store its messages/header files to the new format of no msg/hdr dirs
# and combined hdr/msg files into one msg file ...
# Maher Awamy <muhri@muhri.net>

echo " Please backup your ~/.cscmail dir prior to running this script !! "
echo " If you have not backed up your data, press crtl C and do it now"
echo " To continue press <enter> "
read
echo ""
echo " ... Entering CSCMail directory ... "
echo ""
cd ~/.cscmail
echo "" > blank
echo " ... Conversion in progress ... "
for i in `find ~/.cscmail -type d -name msg` ;do cd $i ; mv *.msg ../ ; cd ../hdr ; mv *.hdr ../ ; done
rm -fr `find ~/.cscmail -type d -name msg -print`
rm -fr `find ~/.cscmail -type d -name hdr -print`
for i in `find ~/.cscmail -type f -name *.hdr -print`
do
cat $i ~/.cscmail/blank $(echo $i | sed 's/hdr/msg/') > $(echo $i | sed 's/hdr/new/')
done
rm -fr `find ~/.cscmail -type f -name *.hdr -print`
rm -fr `find ~/.cscmail -type f -name *.msg -print`
rm -fr blank
for i in `find ~/.cscmail -type f -name *.new`;  { mv $i $(echo $i | sed 's/new/msg/'); }
echo ""
echo " .... Conversion done !! .... "
echo " .... Creating tmp and sig dirs and moving you sigs there .... "
mkdir ~/.cscmail/tmp
mkdir ~/.cscmail/sig
mv ~/*.sig ~/.cscmail/sig
echo " ... Completely done now !!!  ... "