-
Kmail: Copying Directory Structures and Some Files Therein
As part of the Kmail blank email problem, I conjured up a new, shrunken maildir structure with just the most recent 30 days of email. However, I want to keep all the same folders, even if they have no current email messages, so my filters can sort the incoming mail properly.
The sequence of events:
- shut down Kmail!
- move existing email directory out of the way
- set up a new directory
- copy the directory structure
- copy the most recent 30 days of email
- delete the existing index files
That’s straightforward, at least after you figure it out. Took me a while to get it right, but here ya go…
cd to the directory holding the Mail folder mv Mail Mail.base mkdir Mail cd Mail.base find . -type d -print0 | cpio --null -dmpv ../Mail find . -type f -mtime -30 -print0 | cpio --null -apdv ../Mail cd ../Mail find . -type f -name ".*index" -print0 | xargs -0 rm find . -type f -name ".*index.ids" -print0 | xargs -0 rm
Then fire up Kmail and let it rebuild all the index files.
You ought to try that out on a dummy version of your email, as something may have gotten clobbered in the transition from my terminal to your fingertips, OK?