用指令find查詢時排除特定目錄(資料夾)

只排除一個目錄:
find /dir1  -path "/dir1/aa"  -prune -o  -name "test*" -print

排除多個目錄:
find /dir1  -path "/dir1/aa" -prune -o -path "/dir1/bb" -prune -o  -name "test*" -print

如果是要排除目錄時,目錄名稱後面不能加上「/」;但是如果是排除檔案時,就沒有關係。
例如:-path "/dir1/aa/"  -prune -o  -->因為aa是一個目錄,所以會無法排除


-o 表示OR,所以必須在每個表達式之間加入,與程式語言的OR觀念一樣,說明如下:
expression -o expression:Logical OR operator.  True if either or both of the expressions are true.

Oracle DB的listener.log清理