LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2014, 09:16 PM   #1
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Rep: Reputation: Disabled
copy permission ( mode ) of a folder


I have a directory in linux server , its directory permission ( mode ) is drwxrwx---+ , I want to create a directory its mode is the same as this directory , would advise how to copy the mode but not copy anything in the directory ? thanks

I tried , cp -p -r dir dir , but it copy all sub-directory also .
 
Old 11-04-2014, 10:17 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,400

Rep: Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487Reputation: 1487
rsync with the "-d" option can do that. Be sure not to include a trailing "/" on the source directory name.
Code:
$ rsync -d ~/Desktop /var/tmp
$ ls -la /var/tmp/Desktop
total 24
drwxr-xr-x. 2 rknichols rknichols  4096 2014-11-04 22:16 .
drwxrwxrwt. 4 root      root      20480 2014-11-04 22:16 ..
$
 
  


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
File & Folder Permission and Ownership permission error in Cloud storage. rhcekumaran Linux - Newbie 3 06-14-2013 04:41 AM
Scripts to list folder contents and copy images from folder and subfolders brunces Linux - Newbie 6 11-03-2011 01:23 PM
Restore copy folder&file permission aiushtha Programming 3 12-21-2010 09:02 AM
insufficient permission to copy fonts into font folder Ledfeather Ubuntu 6 05-19-2009 09:59 AM
copy from folder from other linux to user mode linux saritha Linux - Newbie 8 01-04-2008 12:42 PM


All times are GMT -5. The time now is 08:51 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration