copy /backup/current/home/???user>/Maildir -> /home/???user>/Maildir ?

Matthias Schniedermeyer ms at citd.de
Sat Jul 9 06:26:07 MDT 2011


On 09.07.2011 11:23, Emilien Kenler wrote:
> Louis-David Mitterrand <vindex+lists-rsync <at> apartia.org> writes:
> 
> > 
> > Hi,
> > 
> > How can I copy each /backup/current/home/???user>/Maildir into
> > /home/???user>/Maildir ?
> > 
> > Thanks,
> 
> 
> Hi,
> 
> you can try this
> 
> for i in /backup/current/home/ ; do 
> cp /backup/current/home/${i}/Maildir /home/${i}/Maildir; 
> done

That statement contains several errors. And is also slightly offtopic 
(doesn't use rsync).

This should work:

cd /backup/current/home
for i in *
do
  rsync -av --delete "/backup/current/home/$i/Maildir/" "/home/$i/Maildir/"
done

I made a few assumptions:
- Only directories under home
- All directories have a Maildir
- No user-dir is missing on target-side
- There is nothing special, like hardlinks, ACL, xattr ...





Bis denn

-- 
Real Programmers consider "what you see is what you get" to be just as 
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated, 
cryptic, powerful, unforgiving, dangerous.



More information about the rsync mailing list