Computing.Net > Forums > Unix > exclude dire with find command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

exclude dire with find command

Reply to Message Icon

Name: mehulnp
Date: March 22, 2008 at 15:47:14 Pacific
OS: Unix
CPU/Ram: unix
Product: solaris
Comment:

I have a directory sturucture as below
/appl/export/ivdevl/comp
/appl/export/ivdevl/comp/buildscripts
/appl/export/ivdevl/comp/buildscripts/pkg.sh
/appl/export/ivdevl/release
/appl/export/ivdevl/comp/x
/appl/export/ivdevl/comp/y
/appl/export/ivdevl/comp/file1
/appl/export/ivdevl/compfile2

I need to execute pkg.sh such that it copies all the files/directories under
/appl/export/ivdevl/comp to
appl/export/ivdevl/comp/package directory (which will be created by script) and need to exclude
/appl/export/ivdevl/comp/package
/appl/export/ivdevl/comp/release
/appl/export/ivdevl/comp/buildscripts dir

i tried the below
#!/usr/bin/ksh
packagedir=../package
rm -rf $packagedir
mkdir $packagedir
cd ..;find . \( -name "package" -o -name "release" -o -name "buildscripts" \) -prune -o | cpio -pdumv ./package

it fails as below
bash-2.03$ ./package.sh
find: bad option
find: path-list predicate-list
0 blocks
bash-2.03$


on cmd line it works find any help would be apprecaited

Thx
Mehul



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: March 22, 2008 at 20:01:07 Pacific
Reply:

I don't have time to check this out in depth, but I can tell you that you have one find syntax error. Remove the -o for or switch before piping to cpio:


find . \( -name "package" -o -name "release" -o -name "buildscripts" \) -prune | cpio -pdumv ./package


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: exclude dire with find command

Clean up the / fs with find command www.computing.net/answers/unix/clean-up-the-fs-with-find-command/1417.html

Using find command www.computing.net/answers/unix/using-find-command-/2853.html

Limiting the find command www.computing.net/answers/unix/limiting-the-find-command/6637.html