find之depth參數

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

也即是說在不加-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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章