The only thing I have noticed with Dysfunction's idea, which I would have also suggested, is that the file you redirect output to (I think that's the right phrase) will also include the name of the file you redirect to. To clarify, let me show you.
If I execute
ls > test.txt in my home directory, the content of test.txt is as follows:
Desktop
Documents
Downloads
Library
Movies
Music
Pictures
Public
Sites
test.txt
So, as you can see, the file you are trying to save the output of ls to is also included in that list. This also occurs for the aforementioned find command. One simple way around this would be to redirect to a file outside of the directory you are trying to get the contents of. So, for instance, you could execute the following:
If you prefer Dysfunction's find command above, you can also change the redirect file:
Code:
find . -depth 1 -type file > ~/Desktop/exampleFile.txt
Each of these will output the file to the desktop. You can of course change where the file is written to.