LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-28-2009, 04:12 PM   #1
zefram
Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 42

Rep: Reputation: 15
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?
 
Old 04-28-2009, 04:23 PM   #2
zefram
Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 42

Original Poster
Rep: Reputation: 15
A friend just gave me a way:

rsync -d source dest

Thanks anyway :-)
 
Old 04-28-2009, 05:06 PM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Use
Code:
rsync -dt source destination
if you want to preserve the timestamp, too.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy entire contents brick_46143 Linux - Newbie 15 02-27-2008 11:46 AM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 04:02 AM
help doftware that will copy video cd contents b123coder Linux - Software 2 04-13-2006 12:42 AM
How can I copy a directory and it's contents with CLI? CyberLord_7 Linux - General 2 03-30-2004 11:35 AM
Copy contents of one partition to another. cparker15 Linux - Software 1 06-26-2003 01:17 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration