【发布时间】:2014-12-12 01:11:09
【问题描述】:
我正在开发一个使用非常有限的 linux busybox shell 的项目。
我的 shell 没有诸如 find、awk、grep 之类的命令,我正在尝试获取该机器上文件的完整列表。
到目前为止没有运气,但运行 ls -la /* 完成了一半的工作并显示了一层深度的文件。
您对我如何递归运行ls 以获取文件和文件夹的完整列表有任何想法吗?也许您知道其他方法可以做到这一点?
编辑#1:
我的 ls 没有 -R 选项。
ls -1 -LR /
ls: invalid option -- R
BusyBox v1.01 multi-call binary
Usage: ls [-1AacCdeilnLrSsTtuvwxXk] [filenames...]
List directory contents
Options:
-1 list files in a single column
-A do not list implied . and ..
-a do not hide entries starting with .
-C list entries by columns
-c with -l: show ctime
-d list directory entries instead of contents
-e list both full date and full time
-i list the i-node for each file
-l use a long listing format
-n list numeric UIDs and GIDs instead of names
-L list entries pointed to by symbolic links
-r sort the listing in reverse order
-S sort the listing by file size
-s list the size of each file, in blocks
-T NUM assume Tabstop every NUM columns
-t with -l: show modification time
-u with -l: show access time
-v sort the listing by version
-w NUM assume the terminal is NUM columns wide
-x list entries by lines instead of by columns
-X sort the listing by extension
【问题讨论】: