Right now I'm calling the the following command ls -R and am receiving an output like this:

.:
file.txt script.php

./dir:
file.txt other.java

Is it possible to get the output to look like this:

./file.txt ./script.php ./dir/file.txt ./dir/other.java

I've looked through the parameters of ls and can't seem to find anything that will do what I want.

link|improve this question

75% accept rate
3  
Not a good idea once your filenames start having space characters in them. – Daniel Beck May 29 '11 at 12:42
feedback

1 Answer

up vote 3 down vote accepted

Try

find . -type f -printf '%p '

It will output one reeeally long line of the file names (incl. path) separated by space. There will be one bonus space at the end of it, too.

(You can trade that in for a newline by piping to sed 's/ $/\n/', which might be a good idea anyway.)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.