我如何吐出一行递归路径的平面列表?

例如,我只想要一个文件的完整路径的平面列表:

/home/dreftymac/.
/home/dreftymac/foo.txt
/home/dreftymac/bar.txt
/home/dreftymac/stackoverflow
/home/dreftymac/stackoverflow/alpha.txt
/home/dreftymac/stackoverflow/bravo.txt
/home/dreftymac/stackoverflow/charlie.txt

ls -a1几乎满足了我的需要,但我不想要路径片段,我想要完整的路径。


当前回答

拥有使用所有可能的ls选项的自由:

查找-type f | xargs ls -1

其他回答

我认为最好的方法是:

find -D tree /fullpath/to-dir/ 

(或者为了保存到TXT文件中)

find -D tree /fullpath/to-dir/ > file.txt

不要把事情搞复杂。我只是使用这个,得到了一个漂亮的输出:

ls -lR /path/I/need

除了ls,不使用任何外部命令:

ls -R1 /path | 
  while read l; do case $l in *:) d=${l%:};; "") d=;; *) echo "$d/$l";; esac; done

du -a

方便一些有限的设备外壳的查找/定位不可用。

从当前位置的所有文件递归列表:

Ls -l $(查找。类型)