Search code examples
bashshellmvdovecot

script to move files from one directory to another


I have successfully changed my mail imap agent from dovecot to courier-imap, for some required features, how ever i am facing a problem during the maildrop/seive directory structure where i need to move 10000 mailboxes to correct directory structure,

so what i need is a script that will convert to move like this

mv /var/vmail/[ domain ]/[ username ]/Maildir/* /var/vmail/[ domain ]/[ username ]/

and i dont want to run this command 10000 times, its troublesome, could you help with this,

thank you


Solution

  • for dir in /var/vmail/*/*
    do
      mv "$dir"/Mail/* "$dir"
    done