Alex Rivera | Logout

Find all files in a directory that are not directories themselves

Asked 2009-08-19T15:16:25.967
50

I am looking for a way to list all the files in a directory excluding directories themselves, and the files in those sub-directories.

So if I have:

./test.log
./test2.log
./directory
./directory/file2

I want a command that returns: ./test.log ./test2.log and nothing else.

Edit
Report

2 Answers

0
find . -type f
answered 2009-08-19T15:22:03.120
0
$ find . -type f -print

Each file will be on its own line. You must be in the directory you want to search.

answered 2009-08-19T15:24:19.403

Your Answer