回答:
-maxdepth 1現在のコマンド構造に基づいて、オプションで必要なものを取得できると思います。そうでない場合は、のmanページを参照してみてくださいfind。
関連エントリ(便宜上):
-maxdepth levels
Descend at most levels (a non-negative integer) levels of direc-
tories below the command line arguments. `-maxdepth 0' means
only apply the tests and actions to the command line arguments.
あなたのオプションは基本的に:
find DirsRoot/* -maxdepth 0 -type f #This does not show hidden files
または:
find DirsRoot/ -maxdepth 1 -type f #This does show hidden files
1はおそらく彼が望んでいるものです。
-maxdepth 0表示されていない任意のファイルをが、-maxdepth 1意図したとおりに動作している、隠されたファイルがうまくとして表示されていると。
*ではfind DirsRoot/* -maxdepth 0 -type f。省略した場合、ファイルは表示されません。
あなたが探していると思います-maxdepth 1。
-maxdepth 1か?
POSIX準拠のソリューションを探す場合:
cd DirsRoot && find . -type f -print -o -name . -o -prune
-maxdepthはPOSIX準拠のオプションではありません。
find DirsRoot/* -type f -pruneか?
-prunebtwの前に "-o"を挿入するのを忘れました)答えはノーです、それはできません。WHYを単純化できない理由を完全に理解するには、set -xコマンドを発行してから発行するだけで、すぐfind DirsRoot/* -type f -o -pruneに自分で確認できます。根本的な原因は、シェルのDirsRoot/*式の拡張の制限です。
find . -name . -o -prune
-maxdepth 1か?