summaryrefslogtreecommitdiffstats
path: root/mailboxes
blob: 6c645814a21d769077412be325195c7dc6db85aa (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/zsh
#set -x
which pushd &>/dev/null || exit 1

pushd -q ~/Mail/Kronos/
[[ $PWD == */Mail/Kronos ]] && find . -type d -mtime +30 -exec rm -rf {} &>/dev/null \;
popd -q

#today=$(date +%d-%m-%Y)
#yesterday=$(date --date='1 day ago' +%d-%m-%Y)

today=$(date +%Y-%m-%d)
yesterday=$(date --date='1 day ago' +%Y-%m-%d)
other=$(date --date='2 day ago' +%Y-%m-%d)

if [[ ! ${$(readlink ~/Mail/Kronos/Today):t} == $today \
    || ! ${$(readlink ~/Mail/Kronos/Yesterday/):t} == $yesterday  ]];then 
    rm ~/Mail/Kronos/Yesterday &>/dev/null
    ln -sf ~/Mail/Kronos/$yesterday ~/Mail/Kronos/Yesterday
    rm ~/Mail/Kronos/Today &>/dev/null
    ln -sf ~/Mail/Kronos/$today ~/Mail/Kronos/Today
fi


echo "~/Mail/Kronos/Today \
    ~/Mail/Kronos/Yesterday \
    ~/Mail/INBOX/ \
    ~/Mail/Me/ \
    ~/Mail/Dyne/ \
    ~/Mail/Wnohang/ \
    ~/Mail/Search/ \
    ~/Mail/Kronos/ \
    ~/Mail/Yahoo/ \
    ~/Mail/Sent/ \
    ~/Mail/Kronos/$other \
    $(find ~/Mail/ -type d -name new -printf '%d:%[email protected]:%h \n'  \
    | sort -t : -k 1,2 -r  \
    | cut -d : -f 3 \
    |  /bin/grep -v -E '(Chro|Old|Junk|Kro|INBOX|Search|Dyne|Wnohang|Yahoo|Sent|Me|Archive|Important|Todo)' \
    | tr '\n' ' ' \
    |  tr -s ' ') \
    ~/Mail/Important/ \
    ~/Mail/Todo/ \
    ~/Mail/Archive/NITK/ \
    ~/Mail/Archive/Msoft/ \
    ~/Mail/Archive/eBackup/"


#set +x