Copy Structure excluding some folders


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Copy Structure excluding some folders
# 1  
Old 04-13-2010
Copy Structure excluding some folders

Hi

I want to copy the structure from one place to another.

-> cd /hol/;
-> find
. -type d | cpio -pvdm /abc/cat;


while copying the structure I want to exclude some directories like test1 and Test.

I have read somewhere that this can be done with -prune option.

Could anyone please help me in this matter? thanks in advance.


# 2  
Old 04-13-2010
# 3  
Old 04-13-2010
I am using
find . -type d \( ! -name test1 -o ! -name Test -prune \) |cpio -pvdm /abc/cat

to copy only the directories but it is not happening, it is copying everything.

But when I am using

find . \( ! -name test1 -o ! -name Test -prune \) |cpio -pvdm /abc/cat

it is copying the directories and files excluding the two directories Test and test1.

Could someone please help me out?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question