【问题标题】:List all files in a directory with abosolute paths (excluding directories)列出具有绝对路径的目录中的所有文件(不包括目录)
【发布时间】:2010-12-09 15:26:45
【问题描述】:

我目前有:

ls -1 $(pwd)/*

为我提供具有绝对路径的目录中的所有文件 - 但使用每个文件列表开头的目录对其进行格式化。

有没有办法只递归地获取目录中的文件列表(绝对路径) - 不包括目录/子目录本身?

【问题讨论】:

  • 听起来你在描述 ls -1R $(pwd)/*。

标签: linux path directory grep pwd


【解决方案1】:

如果您将其输入其他内容,您可能需要 -print0(处理带空格的文件名)。

例如:找到 . -type f -print0 | xargs --null --no-run-if-empty grep

【讨论】:

    【解决方案2】:
    find $(pwd) -type f -print
    

    find $(pwd) -type f -ls
    

    【讨论】:

    • 如果文件中有空格,则需要编辑此命令的结果 - 空格 -> _.
    猜你喜欢
    • 2016-01-17
    • 2012-04-06
    • 2012-01-13
    • 2018-05-02
    • 1970-01-01
    • 2011-06-04
    • 1970-01-01
    • 1970-01-01
    • 2012-02-22
    相关资源
    最近更新 更多