Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
3  
Not a good idea once your filenames start having space characters in them. –  Daniel Beck May 29 '11 at 12:42

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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