I am on UNIX environment. What I want to achieve is to navigate to a directory, and print out all its folders. For example:
/user/Mike/data/
In the above directory, it has 50 folders. I want to only see the 50 folders in this directory. I used the following command:
ls -d */
However, it will also show all the files within this directory. Is there a way for us to eliminate the listing for files by using my command above?
CodePudding user response:
2 options that I can think of:
ls -l | grep ^d
, but this stats the output.
find * -maxdepth 0 -type d