On Mon, Sep 5, 2016 at 8:29 AM, Richard Owlett <rowl...@cloud85.net> wrote:

> I attempted to copy contents of one partition to another using
>    cp -R /media/richard/myrepo /media/richard/test
>
> /media/richard/myrepo is a hard disk partition
> /media/richard/test   is a USB flash drive
>

I think what you want is the magic tar command:

$tar cf - [files] | (cd /[dir]; tar xf - )

It's wise, just to make sure it's going to do what you expect, to do

$tar cf - [files] | (cd /[dir]; tar tvf - )

first!

Substitute 'u' for 'x' to update files; otherwise, old files will
overwrite newer files with the same name.  (I know; I did it!)

To copy a whole directory; create the parent dir if it doesn't already
exist, then:

$tar cf - [dir] | (cd /[parent_dir]; tar xf - )

I haven't had occasion to use it in a while, but I'm pretty sure it makes a
"perfect" copy.

HTH

Patrick

Reply via email to