Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to list the details of all the directories in my music folder using the following command:

ls -lh "$(find /music -type d)"

However all I get is the return of the find command. Is this syntax correct? I'm using ubuntu server 10.04. I think I remember a few weeks ago trying this on gui ubuntu 10.04 and it seemed to output the details of the ls command

share|improve this question

1 Answer 1

up vote 4 down vote accepted

It works, without the quotes

ls -lh $(find /music -type d)

With the quotes ls -l sees the find as a single file rather then a list of items. Look closer at the output , do you not see

ls: cannot access ...
list of find results
last item : No such file or directory
share|improve this answer
    
Yeah, what caught me off guard is my file names contain spaces so I can't do an ls on the return of the find command –  user784637 Jan 7 '12 at 6:42
    
There is a discussion here askubuntu.com/questions/91072/… that covers files with spaces –  bodhi.zazen Jan 7 '12 at 6:58

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.