如何在查找输出中排除目录

Dan*_*n M 5 find

搜索起来非常困难,因为所有结果都是为了排除搜索中的目录。

我只想从输出中排除目录。例如:

>find ./ -size +0
./directory
./directory/afileinthere.txt
Run Code Online (Sandbox Code Playgroud)

我想要这个输出:

>find ./ -size +0
./directory/afileinthere.txt
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

Gom*_*dor 3

您应该查看手册中 find 的 -type 选项:

\n\n
   -type c\n          File is of type c:\n\n          b      block (buffered) special\n\n          c      character (unbuffered) special\n\n          d      directory\n\n          p      named pipe (FIFO)\n\n          f      regular file\n\n          l      symbolic link; this is never true if the -L option or the -fol\xe2\x80\x90\n                 low  option  is  in effect, unless the symbolic link is broken.\n                 If you want to search for symbolic links when -L is in  effect,\n                 use -xtype.\n\n          s      socket\n\n          D      door (Solaris)\n
Run Code Online (Sandbox Code Playgroud)\n