Sponsored Content
Full Discussion: Copy and keep owner info
Top Forums UNIX for Dummies Questions & Answers Copy and keep owner info Post 5806 by witt on Thursday 23rd of August 2001 06:11:52 PM
Old 08-23-2001
Hello !

trie :

cd /old_dir
find . -depth -print | cpio -pdlmv /new_dir

Good look !

Witt
witt
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

change owner

Dear All, i have a file and i want to change the owner of that file from another user. for example $ ls -l pkc.txt -rw-r--r-- 1 tdmscrdr dba 717 Nov 2 17:10 pkc.txt the owner of pkc.txt file is tdmscrdr and group is dba i want to change the owner of this file from... (7 Replies)
Discussion started by: panknil
7 Replies

2. Solaris

Owner of file gets 'not owner' error for chgrp

Hi Folks, I know that changing users and groups is pretty basic admin, but this one has got me stumped. When I try to change the group of a file for which I am the owner for, it still gives me a 'Not owner' error. For example, when I am logged in as 'webadmin', I have the following file: ... (4 Replies)
Discussion started by: brizrobbo
4 Replies

3. UNIX for Dummies Questions & Answers

How to copy owner permissions to group

Hi, I need a command or a script to change the group permissions to be the same as the owner permissions for all my files and directories (recursive) any idea ? (4 Replies)
Discussion started by: ynixon
4 Replies

4. UNIX for Advanced & Expert Users

How UNIX admin set up this? how files of 744 of other owner can be removed by another owner?

Hi all, We have some files are under 744 permissions and the the owner is say owner1 and group1. Now we have another user owner2 of group2, owner2 can remove files of the owner1 and the permission of those files are 744, unix admin told us he did some config at his side so we can do that. ... (14 Replies)
Discussion started by: TheGunMan
14 Replies

5. Shell Programming and Scripting

Need help to copy the lease info block

Hi, am having a lease file which contains lots os lease info. In that i have to copy the whole block(shown below) by identifying the mac and change the IP according to the i/p. I have used like sed s/${ip_addr}/$ch_ip/g $temp_file | grep -B5 "${mac}" >> $persistent_file sed... (2 Replies)
Discussion started by: SMNK
2 Replies

6. Shell Programming and Scripting

How to find DL Owner info using ldapsearch?

Currently i have following syntax: ldapsearch -D "CN=..,OU=..,OU=All Businesses,DC=..,DC=..,DC=.." -w .. -h .. -p .. -b "OU=All Businesses,DC=..,DC=..,DC=.." "managedObjects=$DL_NAME_CN" employeeNumber givenName sn -S employeeNumber -x which gives me following info: "requesting:... (0 Replies)
Discussion started by: arsenghani
0 Replies

7. Shell Programming and Scripting

How to extract the day of the year and use that info to copy a file remotely

Hello, Thank you in advance for helping a newbie who is having great trouble with this simple task. I'm allowed to copy one file remotely each night due to bandwidth restrictions. A new file gets generated once a day, and I need to copy the previous day's file. Here is what I'd like to do:... (1 Reply)
Discussion started by: tmozdzen
1 Replies

8. Solaris

Privileges : modify dir/file owner by other that's not owner

i need to do the following operations in solaris 10: 1.change owner and group owner for files which are not owned by the current user and user group 2.to can delete files in the /tmp directory which are not of the current user 3. allow to a standard user the deletion of files in the /tmp... (1 Reply)
Discussion started by: sirmark
1 Replies

9. Solaris

Folders with more than one 'owner'

I have a peculiar problem. I have a particular directory with the following characteristics: -bash-3.00# ls -lah total 18 drwxr-x--- 7 gandalf shire 512 jul 3 07:20 . drwxr-x--- 11 gandalf shire 512 mai 10 2010 .. drwxr-xr-x 6 gandalf shire 3,0K jul 24 19:25 brasdeff drwxr-xr-x... (9 Replies)
Discussion started by: poyato
9 Replies

10. Shell Programming and Scripting

Script to copy certain info from several directories

Hi, I am writing a script to copy certain file name in txt file . It is working fine if I provide a single directory name (for example "/eos/uscms/store/user/pooja04//analysis2012/525/data/doubleele/2012/datav1/" ) where those specific files are present ending with *root . But I want to modify... (14 Replies)
Discussion started by: nrjrasaxena
14 Replies
cpio(1) 						      General Commands Manual							   cpio(1)

Name
       cpio - copy file archives in and out

Syntax
       cpio -i [ -C ] [keys] [patterns]

       cpio -o [keys]

       cpio -p [keys] directory

Description
       The  command  is  a filter designed to let you copy files to or from an archive.  The command differs from the command in that lets you ar-
       chive any kind of file, while is limited to program object files.

Options
       -i   Copies files that match the specified pattern.  If the pattern is not specified, copies in all files.  Extracts files from	the  stan-
	    dard  input,  which  is  assumed to be the product of a previous cpio -o, and places them into the user's current directory tree.  For
	    files with the same name, the newer file replaces the older file unless the -u option is used.

	    Only files with names that match patterns are selected.  The patterns are specified using the notation for names described in In  pat-
	    terns,  the  slash	for  directories (/) is included in searches using meta-characters.  For example, suppose the archive contains the
	    file and the pathname information in the archive indicates that the directory below contains the file This command copies  both  files
	    into the user's current directory:
	    cpio -i *p < /dev/rmt0l

	    Multiple  patterns	may be specified and if no patterns are specified, the default for patterns is * (that is, select all files).  The
	    extracted files are conditionally created and copied into the current directory tree based upon the options described below.  The com-
	    mand has three function keys, each with its own set of options.

       -C   Specifies  compatability mode for reading archives created with the old style header format.  Use this option to copy in archives gen-
	    erated by pre-V4.2 This option is valid only for copy-in (-i) operations.

       -o   Copies out the specified files.  Reads the standard input to obtain a list of path names and copies those files onto the standard out-
	    put together with path name and status information.

       -p   Copies  files  into  the specified destination directory, which must already exist.  Reads the standard input to obtain a list of path
	    names of files that are conditionally created.  This list of files is copied into  the  destination  directory  tree  based  upon  the
	    options used.  For files with the same name, the newer file replaces the older file unless the -u option is used.

Keys
       6    Processes a file with the UNIX System Sixth Edition format.

       a    Retains  original  access  times  of  input  files, and can be used with -o and -p.  Normally, the read(s) used in the copy update the
	    copied file's access time.

       B    Determines input/output is to be blocked 5,120 bytes to the record.  This option is meaningful only with data directed to or from or

       b    Swaps both bytes and halfwords.

       c    Creates header information in ASCII format and can be used with -i and -o.

       d    Creates subdirectories, as needed, below the specified destination directory.

       f    Copies all files except those that match the specified pattern.

       k    Enables symbolic link handling and is used with the -i, -o, and -p options.

       l    Creates links wherever possible.

       m    Retains modification time for each copied file.  This option does not work on directories or symbolic links that are being copied; the
	    directory is always reset to show the access time when the copy was made.

       r    Interactively renames files.  If you respond with a null line, the file is skipped (not copied).  Use only with the -i option.

       s    Swaps bytes while copying files in.

       S    Swaps half words while copying files in.

       t    Prints a table of contents of the input (no files are created).

       u    Copies files unconditionally.  (Otherwise, an older file will not replace a newer file with the same name).

       v    Displays  detailed	(verbose)  information as it copies and/or creates file.  When used with the t option, the table of contents looks
	    like the output of an ls -l command.  For further information, see

Examples
       This example shows how to copy the contents of the user's current directory into an archive.
       ls | cpio -o  > /dev/rmt0l
       This example shows how to duplicate a directory hierarchy.
       mkdir ~phares/newdir
       cd ~phares/olddir
       find . -print | cpio -pdl ~phares/newdir
       This example shows how to copy all files and directories with names containing the characters "chapter" in user smith's home directory  and
       underlying directories.
       find ~smith -name '*chapter*' -print | cpio -o > /dev/rmt0h
       This example shows the results of using the r option with the -i function key.
       ls | cpio -ir > ~smith/newdir
       Rename <file1>
       newnamefile1
       Rename <file2>
       <RETURN>
       Skipped
       Rename <file3>
       newnamefile3
       In  some  cases,  the  -cpio  option of the command can be used more effectively than pipes and redirects using For instance, the following
       example
       find . -print | cpio -oB > /dev/rmt0l
       can be handled more efficiently by:
       find . -cpio /dev/rmt0l
       To copy the contents of a directory (with symbolic link handling enabled) to the tape drive, type:
       ls | cpio -ok > /dev/rmt0h
       To restore the archived files back into a directory, type:
       cpio -ik < /dev/rmt0h
       The following example moves files, including symbolic links, from an old directory to a new directory:
       mkdir ~craig/newdir
       cd ~craig/olddir
       ls | cpio -pdk ~craig/newdir

Restrictions
       Pathnames are restricted to 128 characters.

       When there are too many unique linked files, the program runs out of memory and cannot trace them.  In this case,  linking  information	is
       lost.

       Only the superuser can copy special files.

See Also
       ar(1), find(1), cpio(5)

																	   cpio(1)
All times are GMT -4. The time now is 11:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy