LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 08-13-2008, 12:33 PM   #1
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84

Rep: Reputation: 15
Keeping owner info when moving a directory


I need to rename a directory.
ex) rename "bye" to "hello".
And I'd like to keep the owner:group (and the permissions as well if possible) info. of the "bye" directory and its contents after it's renamed to "hello".

Is this possible?

Thanks.
 
Old 08-13-2008, 12:40 PM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 10,003

Rep: Reputation: 1189Reputation: 1189Reputation: 1189Reputation: 1189Reputation: 1189Reputation: 1189Reputation: 1189Reputation: 1189Reputation: 1189
Quote:
Originally Posted by linuxfia View Post
I need to rename a directory.
ex) rename "bye" to "hello".
And I'd like to keep the owner:group (and the permissions as well if possible) info. of the "bye" directory and its contents after it's renamed to "hello".

Is this possible?
Yes. Check out the man page for cp. I think the --preserve option is what you're looking for.
 
Old 08-13-2008, 04:12 PM   #3
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84

Original Poster
Rep: Reputation: 15
Thanks, the --preserve flag worked like a charm.
 
Old 08-13-2008, 09:11 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.2, Centos 5.8
Posts: 11,740

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
What's wrong with 'mv' ?
 
Old 08-14-2008, 11:12 AM   #5
linuxfia
Member
 
Registered: Apr 2008
Distribution: ubuntu 7.10, centos 4 & 5
Posts: 84

Original Poster
Rep: Reputation: 15
Actually I needed to keep the old directory so used cp.
I should've said copy not rename in my post.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nfs change owner during wwrite to directory vgulch Linux - Server 1 01-25-2008 03:57 AM
Get the owner of a directory frayja Linux - Software 3 08-31-2007 01:49 PM
can't change owner of directory miner49er Linux - Networking 1 05-04-2006 03:58 PM
Owner of file in shared directory changing Gunbunny Linux - General 4 01-13-2006 07:00 PM
Changing owner of a directory recursively? fturcic Linux - General 2 02-01-2005 07:13 AM


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

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
Open Source Consulting | Domain Registration