Skip to main content
deleted 44 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 239

I have a directory /srv/tftp/pxelinux.cfg and a file /etc/mtab. I want to exclude both from find. But whatever I do, either one always is not excluded

find /etc /srv -path /srv/tftp/pxelinux.cfg -prune -o \! -path /etc/mtab find /etc /srv \( -path /srv/tftp/pxelinux.cfg -prune -o -print \) -a \( \! -path /etc/mtab \) 

could somebody please advise how to do it?

Note: I find the -path /foo -prune -o -print syntax highly confusing and unintuitive

I have a directory /srv/tftp/pxelinux.cfg and a file /etc/mtab. I want to exclude both from find. But whatever I do, either one always is not excluded

find /etc /srv -path /srv/tftp/pxelinux.cfg -prune -o \! -path /etc/mtab find /etc /srv \( -path /srv/tftp/pxelinux.cfg -prune -o -print \) -a \( \! -path /etc/mtab \) 

could somebody please advise how to do it?

Note: I find the -path /foo -prune -o -print syntax highly confusing and unintuitive

I have a directory /srv/tftp/pxelinux.cfg and a file /etc/mtab. I want to exclude both from find. But whatever I do, either one always is not excluded

find /etc /srv -path /srv/tftp/pxelinux.cfg -prune -o \! -path /etc/mtab find /etc /srv \( -path /srv/tftp/pxelinux.cfg -prune -o -print \) -a \( \! -path /etc/mtab \) 

Note: I find the -path /foo -prune -o -print syntax highly confusing and unintuitive

Source Link
Martin Vegter
  • 848
  • 81
  • 257
  • 449

find: combining -path and -prune to exclude files and directories

I have a directory /srv/tftp/pxelinux.cfg and a file /etc/mtab. I want to exclude both from find. But whatever I do, either one always is not excluded

find /etc /srv -path /srv/tftp/pxelinux.cfg -prune -o \! -path /etc/mtab find /etc /srv \( -path /srv/tftp/pxelinux.cfg -prune -o -print \) -a \( \! -path /etc/mtab \) 

could somebody please advise how to do it?

Note: I find the -path /foo -prune -o -print syntax highly confusing and unintuitive