tags:

views:

39

answers:

0

Hi!

I need to come up with a find command that includes a few prunes as well as a find for multiple files.

Here's what I need to come up with, in one command:

./virtfs -prune -o -type f -name error_log 
\( -path "./virtfs" -prune -o -path "./*/mail" \) -prune -o -type f -wholename '*/.trash/*'
-path ./virtfs -prune -o -type f -iregex '.*/core\.[0-9]*$'
-path ./virtfs -prune -o -type f -iregex .*/[.]pureftpd-upload.*$

As you can see, I need to prune paths from each of the commands, and prune 'mail' from the '.trash' find.

I've tried to come up with the correct syntax on my own, however I'm failing.

TYIA!

Edit: Pretty much, what I'm trying to do is combine the following finds, while respecting the folder prunes:

     #Error_Logs
#       find -P . -path ./virtfs -prune -o -type f -name error_log -exec chattr -R -ia {} \; -exec rm -f {} \;
     #.Trash folders
#       find -P . \( -path "./virtfs" -prune -o -path "./*/mail" \) -prune -o -type f -wholename '*/.trash/*' -exec rm -fv {} \;
     #Core Files
#       find -P . -path ./virtfs -prune -o -type f -iregex '.*/core\.[0-9]*$' -exec chattr -R -ia {} \; -exec rm -f {} \;
     #pureftp-upload files
#       find -P . -path ./virtfs -prune -o -type f -iregex .*/[.]pureftpd-upload.*$ -exec rm -fv {} \;

I've come up with something like, however it's a HOG:

find -P . \( -path "./virtfs" -prune -o -path "./*/mail" -prune \) -o \( -type f -name error_log -size +10M -o -wholename '*/.trash/*' -o -iregex '.*/core\.[0-9]*$' -o -iregex '.*/[.]pureftpd-upload.*$' \)

I wonder if there may be a way to reduce the I/O or increase the efficiency of this?