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.
If you want
find . -type f
If you do not want
find . -maxdepth 1 -type f
If you need symlinks, pipes, device files and other specific elements of file system to be listed too, you should use:
find -maxdepth 1 -not -type d
This will list everything except directories.