copying of files by userB, dir & files owned by userA


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users copying of files by userB, dir & files owned by userA
# 1  
Old 08-04-2009
copying of files by userB, dir & files owned by userA

I am userB and have a dir

/temp1

This dir is owned by me.

How do I recursively copy files from another users's dir userA?

I need to preserve the original user who created files, original group information, original create date, mod date etc.


I tried

cp -pr /home/userA/* .

but it shows the files as being created by me.

So how do I do this?

Thanks in advance.

Smilie
# 2  
Old 08-07-2009
use cpio or tar
# 3  
Old 08-07-2009
Assuming you have read permissions to userA's files:
One way (with cpio). This method is described in both "man find" and "man cpio".

Code:
cd /home/userA
find . -type f -print|cpio -pdumv /temp1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Assign read write permission to the user for specific dir and it's sub dir and files in AIX

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies

2. Shell Programming and Scripting

Search for files owned by particular owner and group

I am searchingfor files owned by particular owner and group in a particular directory including its sub-directories. I use find <dir> -user <user> -group <group> -exec ls -l {} \; It does not work completely. In the sense is a subdirectory is owned by 'user' and group 'group' then all... (9 Replies)
Discussion started by: Soham
9 Replies

3. Shell Programming and Scripting

PERL - Copying ONLY files from one dir to another

I'm writing a Perl script which has its 1st step as to copy files from one directory to another directory. The Source directory has got files with extension, without extension, directories etc. But I want to copy ONLY files with no extension. The files with extensions and directories should not get... (2 Replies)
Discussion started by: jhamaks
2 Replies

4. Shell Programming and Scripting

Issue with copying files into dir inside for loop

Hi , I'm trying to move/copy the files inside the loop into a directory . I tried the below code and the issue is the data is not copying into the created directory but the files are copying into another file file_path="/home/etc" Last_Day=20130930 mkdir $file_path/ARC_${Last_Day} ... (3 Replies)
Discussion started by: smile689
3 Replies

5. Shell Programming and Scripting

Copying files to new dir structure.

I am trying to figure out a way to script copying specific files from one dir structure to another. I have a dir structure like this: dira/author 1/book 1/file a.epub /book 2/file b.epub /author 2/book 1/file c.epub /author 3/book 1/file d.epub /book 2/file... (2 Replies)
Discussion started by: arcanas
2 Replies

6. Red Hat

sudo from userA to userB

Hi all I am trying to get this user db2s12 to be able to sudo as user sapr3 to run the sapr3 commands I have tried so many options with my sudoers file but the single response I get is this : password for db2s12: H99A100:db2s12 53> sudo su - sapr3 password for db2s12: Sorry, try... (3 Replies)
Discussion started by: hedkandi
3 Replies

7. Shell Programming and Scripting

Finding & Copying files

Hello :) can someone please help me with this task: I am in the shell, in folder "Main" below the folder Main are sub folders: "sourceA", "Source B", and "target" in sourceA and source B are files, and in folder "Main" is a textfile, with filenames, one filename per line. I need a... (4 Replies)
Discussion started by: Y-T
4 Replies

8. Shell Programming and Scripting

Copying specific files from one dir to another

Hi Folks, I have one curious case. There are list of following files placed in one directory such as... And updated each month. files.JAN09.csv files.FEB09.csv files.MAR09.csv ..... Now, I need to move a specific files; i.e, For this month, I need to move only OCT09, NOV09, DEC09,... (1 Reply)
Discussion started by: Jerald Nathan
1 Replies

9. Shell Programming and Scripting

copying files to new dir

Hello, I'm new to shell scripting so I don't really understand what I'm doing wrong. The script I'm trying to do saves all the files (*.c) on the current dir to a list and, one by one, copies them to a new one called Backup. The thing is, if there are already other versions of the files I'm... (6 Replies)
Discussion started by: G3nn
6 Replies

10. Shell Programming and Scripting

How to copy specified files from list of files from dir A to dir B

Hello, fjalkdsjfkldsajflkajdskl (3 Replies)
Discussion started by: pmeesara
3 Replies
Login or Register to Ask a Question