-   Linux - General (
-   -   Excluding directories with find (

metallica1973 06-10-2011 04:57 PM

Excluding directories with find
I am trying to exclude 2 directories with find and pass it into cpio. I have tried


find . -depth -path '.evolution' -prune -o -path '.gconf' -prune -o -print|cpio -aov  > /media/caca/full$date

as you can see it didnt exclude .gconf and


find . -depth \( -path ./evolution -prune -o -path ./gconf -prune \)  -print|cpio -aov  > /media/caca/full$date
1 block


find . \( -wholename ./evolution -o -wholename ./gconf \) -prune -o -type f -print0 | cpio -aov /media/caca/backup$date
cpio: Too many arguments


find . -type d \( -name ".evolution" -o -name ".gconf" \) -prune -o -print0 | cpio -aov /media/caca/backup$date
cpio: Too many arguments

what am I doing wrong?

Snark1994 06-10-2011 05:08 PM

I don't think you need the '-depth' flag :)


find . -path './FOO' -prune -o -path './BAR' -prune -o print
works for me, and if I add '-depth' between the '.' and '-path', it doesn't.

Hope this helps,

colucix 06-10-2011 05:11 PM


find . \( -wholename ./.evolution -o -wholename ./.gconf \) -prune -o -print
Don't use the -depth option with -prune: it could change the result since the directory content is processed before the directory itself is excluded from the -prune option.

metallica1973 06-11-2011 11:28 PM

this worked


find . \( -wholename ./.evolution -o -wholename ./.gconf \) -prune -o -print
this didnt


find . -path './FOO' -prune -o -path './BAR' -prune -o print
thanks to all :cool:

Snark1994 06-13-2011 05:29 AM

Hehe, sorry, look like I left the hyphen out before 'print'. If your problem is solved, could you mark the thread '[SOLVED]' too? Thanks :)

All times are GMT -5. The time now is 01:26 PM.