The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
100% ownership to files Terrible UNIX for Dummies Questions & Answers 3 12-05-2006 09:40 AM
ftp files -- but keep the original timestamp Perderabo Answers to Frequently Asked Questions 0 07-23-2006 08:43 AM
copy directory without changing ownership setting legato UNIX for Dummies Questions & Answers 2 08-17-2005 06:53 AM
ownership of files szhu UNIX for Dummies Questions & Answers 4 12-31-2003 08:59 AM
using tar command to copy files? tomapam UNIX for Dummies Questions & Answers 2 07-23-2002 03:56 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2008
Registered User
 

Join Date: Jan 2008
Posts: 1
command to copy files with original ownership

Hi,

I need a command that to copy files from others and to keep files' ownership.
Example: I copy file.txt from users "abc" to my local, and file.txt is own by user "abc" in local.

Thanks in advance!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-08-2008
Registered User
 

Join Date: Oct 2007
Posts: 70
cp -p <path/filename> <path/filename>
Reply With Quote
  #3 (permalink)  
Old 02-08-2008
Registered User
 

Join Date: Oct 2007
Posts: 70
Also can be done in 2 steps.
1) Copy the file
2) Change the ownership.

Copy -p preserves the permission, modification time of the original userid
Reply With Quote
  #4 (permalink)  
Old 02-08-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,032
another possibility if you copy not only single files but nested directory hierarchies:

Code:
cd srcdir
tar -cf - * | (cd /target/dir; tar -xf - )
bakunin
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0