Daniele Ravizza
Daniele Ravizza

Reputation: 121

Move Maildir contents to parent directory

i have to change my virtual mail folder tree.

I've configured a new mailserver and now i must import my old virtual mailboxes.

My old one directory was like /var/spool/vmail/domain.com/account/Maildir with inside ( cur / new / ...). I have to move like that /var/spool/vmail/domain.com/account

so i have to do this for every domain. Move all from Maildir to parent folder (the account folder).

I need a script cause there are hundreds of folders.

Thank you so much for any suggestion

Upvotes: 0

Views: 384

Answers (2)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200373

Try this:

for f in /var/spool/vmail/*/*; do
  mv "$f/Maildir"/* "$f"/
  rmdir "$f/Maildir"
done

Upvotes: 1

devnull
devnull

Reputation: 123608

How about cd /var/spool/vmail/domain.com/account/Maildir; mv * ..

Upvotes: 0

Related Questions