using find to display ALL directories
From man find:
Quote:
for -name option. I am trying to get the equivalent of these combined commands of listing ALL directories in current directories using find commmand: Code:
> ls -dl */ hidden and visible directories ONLY (excluding files) in a single command? Here is the find command I tried with no success: Code:
find . -maxdepths 0 -type d -name * "find: paths must precede expression: ..... " Why does -name option not work? Thank you. |
If you want to list all directories in the current directory using the command and parameters you have mentioned in your post then:
Code:
find . -maxdepth 1 -type d |
Quote:
I obviously misunderstood -maxdepth description in man page. I still did not understand why option, -name *, produces an error. |
Quote:
Code:
for i in *;do echo "$i"; done |
Quote:
This works now. Code:
find . -type d -name "*" Add quotes if you want to prevent current shell from globbing arguments to command or its options. |
Quote:
Code:
ls -dl {,.}*/ Code:
shopt -s dotglob |
Quote:
Now I will have to read up on brace expansion! |
Hi. fanoflq answer is a good method.
By the way, you can use it to find directories with pattern name: find . -type d -name 'pattern*pattern2' or must be to dont show directories with a pattern name: find . -type d -prune 'pattern1*pattern2' Have a nice day. |
All times are GMT -5. The time now is 09:44 AM. |