Windows/Ubuntu下,將所有檔名字列舉出來並儲存到txt檔案中
阿新 • • 發佈:2019-02-02
Windows
使用如下的DOS命令來實現:
dir /s /b > lists.txt
可以將當前路徑下的所有檔案的“檔案路徑+檔名”儲存在lists.txt
中。
其中,/s
表示的是“列出完整路徑”選項,如果命令列是如下形式:
dir /b > lists.txt
那麼,lists.txt
檔案中只會記錄當前目錄中所有檔案的檔名資訊。
Ubuntu
find <target_path> -name "<file_name>.<file_type>" > lists.txt
示例:
find . -name "*.*" > lists.txt
表示在當前目錄下將所有格式的檔案的名字,存放到lists.txt
中去