[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problem selecting options for cp command



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Sep 05, 2016 at 08:43:44AM -0400, Patrick Wiseman wrote:
> On Mon, Sep 5, 2016 at 8:29 AM, Richard Owlett <rowlett@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!

While basically correct, this is antiquated.

It stems from the good ol'days "cp" had no -a option. With the
ubiquity of the Gnu tools (thanks, Gnu!), you have cp -a, which
is what you really want. Or rsync (especially if you expect having
to stop the copy operation mid-way and restart it, or if you have
an old version of the copy to start of, as in backups).

When copying across machine boundaries, use rsync. Much nicer.
As in "by orders of magnitude much nicer".

Regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlfNa8QACgkQBcgs9XrR2kYI+QCfVEyF9/35j6+WLYEjDXqfUiWZ
AdsAn1w35Wxia/I1B6yaos+JF+zl+kaf
=dHpj
-----END PGP SIGNATURE-----


Reply to: