![](/img/trans.png)
[英]in linux, how to (quickly) get a list of all files in a directory - with their filesize
[英]How to list all files in all directory in linux using linux cmd
我正在嘗試使用 bash 腳本讀取所有目錄中可用的所有文件以及完整路徑。 試過
ls -R
cmd 但它沒有正確列出文件。
我的要求是輸出應該具有文件的完整路徑。
也許您想要默認情況下遞歸的find
實用程序。
find . -type f
.
表示當前密碼/目錄
您可以使用find
命令列出特定目錄中的所有文件。
find /your_path/ -type f 2>/dev/null
/your_path/ : provide the path from where you will execute the command, the output will have the complete path of the files.
2>/dev/null : to suppress the STDERR
現在您要嘗試的是使用ls -R
列出所有子目錄,因此這無法實現您要實現的目標。
見man ls
:
-R, --recursive
list subdirectories recursively
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.