Copy all files and subdirectories preserving time stamp?

Ian Smith smithi at nimnet.asn.au
Mon Aug 23 22:13:33 PDT 2004


Re: freebsd-questions Digest, Vol 74, Issue 3
Message: 14

 > What would be the way to copy all files and subdirectories
 > from one directory to another--preserving the time stamp
 > and other attributes?
 > 
 > It seems that 'cp' usually puts a time stamp of the 
 > current date and time.
 > 
 > Would this work?
 > 
 > cp -r -p -@ /some/source/directory/* /some/target/directory/

# cp -pR dir1 dir2

works for me.  See the note in 'man cp' re hard linked files, though.

Ian



More information about the freebsd-questions mailing list