find之depth參數

man find 
-depth Process each directory’s contents before the directory itself.
而後查了下,暫時記錄下,待整理:
參數-depth 的意思是:在處理目錄之前首先處理目錄下的子內容。oracle

也便是說在不加-depth的時候, 處理順序是首先處理目錄自己,而後處理目錄下的子內容。加不加-depth參數,會影響輸出結構的輸出順序。
-------------------------------------------------------------
例以下面的兩個命令,輸出結果是相反的:
先輸出子內容,再輸出上層目錄內容,直到最頂層:
[oracle@oracledb ~]$ find test -depth  ! -empty
test/test1/test2/test3
test/test1/test2
test/test1
test

先輸出頂層目錄,再輸出下面的各層子目錄內容,直到最低層:
[oracle@oracledb ~]$ find test   ! -empty
test
test/test1
test/test1/test2
test/test1/test2/test3
ide

相關文章
相關標籤/搜索