tl:dr I am trying to get find to completely ignore a specific subdirectory regardless of depth.
I am asking this question in reference to a line of code from maldets open source. It is the find command that generates the filelist that the scanner is to examine. I know find will start at whatever dir specified, at a given maxdepth value.
Is it possible to change the maxdepth level at say dir/subdir/Thisleveldir so that when using the flag -D search
nothing below Thisleveldir/ is listed?
For instance I want to search the /home directory to a max depth of 15
find /home -maxdepth 15 -type f -size +100M
until the pwd is /home/user/ReallyHugeDirThatDoesntNeedToBeSearched/ at which point -maxdepth gets set to 1 then once the pwd again is not that specific subdirectory -maxdepth reverts to its previous value of 15.
Is this possible?