question: copy command
Bob McClure Jr
robertmcclure at earthlink.net
Thu Dec 9 22:30:34 UTC 2004
On Thu, Dec 09, 2004 at 05:14:17PM -0500, GoijI P wrote:
> please, what's best and least risky command to copy contents of directory
> /dir to /Mydir?.
This assumes you want a recursive copy.
mkdir /Mydir # if it doesn't exist already
cd /dir
find . -depth -mount | cpio -pdmv /Mydir
That will not overwrite any files of the same name in /Mydir if their
timestamps are newer than the corresponding files in /dir. If you
want to force it, add the "u" (unconditional overwrite) option to the
cpio command.
If executed as root, ownership of the copied files in /Mydir will
be the same as they were in /dir. If executed as your mere mortal
self, the new files in /Mydir will be owned by you.
Cheers,
--
Bob McClure, Jr. Bobcat Open Systems, Inc.
robertmcclure at earthlink.net http://www.bobcatos.com
Grace happens.
More information about the Redhat-install-list
mailing list