LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Copy a directory without contents (https://www.linuxquestions.org/questions/linux-software-2/copy-a-directory-without-contents-722330/)

zefram 04-28-2009 04:12 PM

Copy a directory without contents
 
Hi

Is there a way to copy a directory without copying the contents, but preserving ownership, timestamp etc of that directory?

I've looked at the cp man page, but I don't think it supports it. I'm thinking one would have to write a script to gather the info, and then mkdir, chown and touch. Does this seam right?

zefram 04-28-2009 04:23 PM

A friend just gave me a way:

rsync -d source dest

Thanks anyway :-)

colucix 04-28-2009 05:06 PM

Use
Code:

rsync -dt source destination
if you want to preserve the timestamp, too.


All times are GMT -5. The time now is 04:35 PM.