Sponsored Content
Top Forums UNIX for Advanced & Expert Users Copy Structure excluding some folders Post 302412605 by vino on Tuesday 13th of April 2010 03:35:31 AM
Old 04-13-2010
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

tar backup with excluding some folders

Hi , I want to backup the root file system but the size of / is very huge so I want to exclude some file systems.Man page of tar says X option excludes files but I could not do that.I use this command $ tar -cvf deneme.tar -X exc . $ cat exc sql kkm I think there... (2 Replies)
Discussion started by: kudret_gulcan
2 Replies

2. Filesystems, Disks and Memory

DD copy excluding empty blocks?

I'm not 100% sure if this was the right place to post in but here i go: I'm attempting to migrate a physical windows disk onto my SAN through the use of the dd copy command. I'm booting into knoppix, running dd, and then bringing the server back up into windows running on the SAN. Everything... (2 Replies)
Discussion started by: Merkilo
2 Replies

3. UNIX for Dummies Questions & Answers

Copy Directories excluding files

Hi guys, I want to copy folder and sub folders only. I don't want the files. If i use cp -r command it will copy entirely with files. Could any one suggest me. Thanks in advance (1 Reply)
Discussion started by: karthik82
1 Replies

4. Shell Programming and Scripting

Copy only folder structure ?

Hello, I am not sure how feasible is it, but trying to copy/create the folders from one box to another. I dont want to copy the content of folder otherwise it'd be too much of data.. The folder structure is quite complex (in deep hierarchy) and its a big effort manually .. Please... (5 Replies)
Discussion started by: navsha
5 Replies

5. UNIX for Advanced & Expert Users

copy a whole partition excluding specified.

Scenario: I would want to copy my / to /mnt, and to avoid recursion exclude /mnt. cp -avx / /mnt If i use the above i believe it would run recursively, and end up in mess. So how to do it ?! Basically this / is sda1, and /mnt is sda2 and sda1 is where only OS is available & currently... (2 Replies)
Discussion started by: thegeek
2 Replies

6. Shell Programming and Scripting

Script to search specific folders dates /mm/dd/ structure

Hi, I have a script that handles a huge amount of log files from many machines and copies it into a SAN location with the following directory structure: /SAN/machinenames/yyyy/m/d so for example /SAN/hosta/2011/3/12/files* Now I am writing a bash script to search for files between to date... (4 Replies)
Discussion started by: GermanJulian
4 Replies

7. UNIX for Dummies Questions & Answers

finding files in unix and excluding certain folders

hi good day I am using redhat linux. Is there a better utility than the 'find' command to search for files I am trying to search through and enitre directory such as /repos for a files that have 'UAP' in it. However there are some '.step' folders littered throughout the /repos folder at varying... (8 Replies)
Discussion started by: johnstrong
8 Replies

8. Shell Programming and Scripting

Copy files/directories excluding multiple paterns

my directory structure is like below: basedir\ p.txt q.htm r.java b\ abc.htm xyz.java c\ p.htm q.java rst.txt my requirement is i want to copy all the files and directories... (0 Replies)
Discussion started by: ajayyadavmca
0 Replies

9. UNIX for Advanced & Expert Users

Copying excluding some files and folders

I have a main folder. Inside that i have many(50) subfolders. In each subfolder, there are a no of large files(500 files ) present. I want to do copy operation for some files from some of the subfolders to /usr/tmp. I have the list of the subfolders and list of of files which i dont want to... (4 Replies)
Discussion started by: millan
4 Replies

10. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 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 10:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy