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
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
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:
Summary: hello unix admin folks I need to clean up my root filesystem because a backup caused the fs full. I know that it accidentally write some file with big size to root I tried the find command with type...
Summary: The man page will give you all that info. You can specify multiple filters on a single find command. For example: find / -user oracle -size +150000c -print will list files owned by oracle and with a ...
Summary: Hi: The GNU find command has a maxdepth option which controls how many directory levels to search. If you don't have it, you can use find's -prune option to search only the top directory: find . \( -...