簡體   English   中英

如何使用linux cmd列出linux中所有目錄中的所有文件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM