#!/bin/bash olduser=$1 newuser=$2 if [ -z "$olduser" -o -z "$newuser" ]; then echo "You need to specify both old and new user" exit 1 fi maildirmake -f $olduser /home/e-smith/files/users/$newuser/Maildir/ cd /home/e-smith/files/users/$olduser/Maildir/ for d in "cur" "new" "tmp" ; do cp -pr "$d" "/home/e-smith/files/users/$newuser/Maildir/.$olduser/" done echo "$olduser" >>/home/e-smith/files/users/$newuser/Maildir/subscriptions for d in .??*; do cp -pr "$d" "/home/e-smith/files/users/$newuser/Maildir/.$olduser$d" echo "$olduser$d" >>/home/e-smith/files/users/$newuser/Maildir/subscriptions done chown -R $newuser:$newuser /home/e-smith/files/users/$newuser/Maildir