Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy a directory 1

Status
Not open for further replies.

jkm

Technical User
Feb 13, 2001
4
US
how to copy a directory ?
 
cp -r should do the trick, the r is for recursive.

Example
cp -r /source /destination

Cheers
pt
 
another option, there's always more than one way to do it, :)
[tt]
cd sourcedir
find . -depth -print | cpio -pdlmv targetdir
[/tt]

this has the advantage that file modification times, ownerships and permissions are all preserved in the new files.

The example above is taken straight from the cpio man page, and targetdir must already exist.
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top