best way to use cp?

Mike Jeays mj001 at rogers.com
Sat Mar 25 23:43:42 UTC 2006


On Fri, 2006-03-24 at 12:38 -0600, Jonathan Horne wrote:
> ok, tell them dumb linux user how to properly copy directories recursivly,
> so he can stop overwritng directories with source files.
> 
> /humor
> 
> ok seriously, tho, i think im doing it wrong.  last night i blasted some
> directories, and when i looked at the destination of where i was supposed to
> be copying to, it was full of all kinds of junk that was supposed to be in
> the top level of the directories i was copying.
> 
> example, i want to copy /mnt/usb1/path/oldfolder  (the folded all its
> recursive contents) into /home/mydir
> 
> im pretty sure i have the syntax wrong, so could someone enlighten me?
> 
> thanks!
> jonathan
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

cp -Rp /mnt/usb1/path/oldfolder/ /home/mydir/

Note the trailing slash on the source directory.  For more information,
see "man cp".  -R says to copy recursively down through directories, and
-p says to preserve permissions, dates and times etc.



-- 
Mike Jeays
http://ca.geocities.com/mike.jeays@rogers.com



More information about the freebsd-questions mailing list