'find' linux command - filter out directories

I'm running this command:
find . > tmp.txt

but it also includes the directory names it finds along the way. Is there a way to filter out the directories?

Thanks
MaritimeSourceAsked:
Who is Participating?
 
AutogardConnect With a Mentor Commented:
My post above will tell it to find just regular files.  But actually if you want to find anything BUT directories then try one of these...

"find ! -type d > tmp.txt"
or
"find \! -type d > tmp.txt"

(source: http://lists.debian.org/debian-user/1996/09/msg00474.html)
0
 
AutogardCommented:
There is a "type" option in find...

=== From the man page for find ===

-type c
              File is of type c:
              b      block (buffered) special
              c      character (unbuffered) special
              d      directory
              p      named pipe (FIFO)
              f      regular file
              l      symbolic link (never true if the -L option or the -follow option is in effect, unless the symbolic link is broken).
              s      socket
              D      door (Solaris)
==============================

So try "find -type f > tmp.txt" (or something similar).
0
 
ranadastidarCommented:
try with locate tmp.txt
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ahoffmannCommented:
Autogard's comment is the answer to the question, locate is (horrible) unreliable.
0
 
ico2Commented:
locate is faster than find though
0
 
ahoffmannCommented:
<off-topic>
doesn't matter how fast imagination is, I'll wait for the truth ;-)
</off-topic>
0
All Courses

From novice to tech pro — start learning today.