[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

(v) ugly (and simple) bash script...



Hi List,

I'm in the process of solving the removal of movemail from T'bird and I feel like I'm on the home straight.

I've swapped T'bird from mbox to Maildir and swapped postfix delivery from mbox to Maildir and the last bit of the puzzle is moving the delivered mail from `~/Maildir/new/*` to `~/Maildir/cur/*.eml` (after linking `~/Maildir` to `[T'bird profile]/Mail/Local Folders/Inbox` .

With a little help from Greg Wooledge:
https://mywiki.wooledge.org/BashFAQ/030
I've come up with:
`cd ~/Maildir/new/; for f in *; do mv -- "$f" ~/Maildir/cur/"${f%}.eml"; cd -; done`
Which perhaps does the job...

```
cd ~/Maildir/new/; for f in *; do echo mv -- "$f" ~/Maildir/cur/"${f%}.eml"; cd -; done mv -- 1653057612.Vfe06I3000a2M156375.morgansmachine /home/morgan/Maildir/cur/1653057612.Vfe06I3000a2M156375.morgansmachine.eml
/home/morgan
```

But, that doesn't seem very elegant to me and I strongly suspect that it can be done a lot better than I have managed on my own - I realise I need to reference the file `*` in `~/Maildir/new/*` but couldn't work out how to do that without also referencing the whole long filename - which gave me `/home/morgan/Maildir/cur//home/morgan/Maildir/new/1653057612.Vfe06I3000a2M156375.morgansmachine.eml` ...

Getting postfix to run that command on mail delivery is the next question?

Thanks
--
Morgan Read


Reply to: