[PLUG] Proper way to copy directories
Vram
lamsokvr at xprt.net
Thu Dec 23 19:45:43 UTC 2004
On Thu, 2004-12-23 at 11:32 -0800, Jason Van Cleve wrote:
> Quoth Richard C. Steffens, on Wed, 22 Dec 2004 10:32:05 -0800:
>
> > cp -r /home /home2
> >
> > This resulted in a copy of home in /home2. In other words, /home2 had
>
> With all us experts on file copy techniques, you might feel silly for
> trying to use a tool so primitive as cp. But after all, it's probably
> all you need.
>
> I wanted to point out that you probably had an existing /home2 directory
> when you ran the cp command above: that would explain why /home ended
> up within /home2. When copying one directory path to another, using cp,
> what happens depends on whether the destination directory already
> exists. If it does NOT exist, then cp will create it as a direct copy
> of the source directory.
>
> Thus, if you remove /home2 completely and then execute
>
> cp -pR /home /home2
>
> you should get what you bargained for. Works for a one-off, but if
> you're doing a backup and plan to repeat it, you should use a more
> suitable tool.
>
> --Jason
Jason
Does this copy your DOT files??
HTH
Vram
More information about the PLUG
mailing list