Specific ls output

3

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.

user49841

Posted 2011-05-29T12:05:44.727

Reputation:

3Not a good idea once your filenames start having space characters in them. – Daniel Beck – 2011-05-29T12:42:57.157

Answers

2

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.)

peth

Posted 2011-05-29T12:05:44.727

Reputation: 7 990