I know I can do this to get a list of directory names:
find . -type d -maxdepth 1
The output looks like this:
.
./foo
./bar
I prefer the listing without ./
. Is there a way to get find to output just the raw names?
I tried sending the list to stat to format it but that just gives me the same result:
find . -type d -maxdepth 1 -print0 | xargs -0 stat -f '%N'
foo bar ...
all on one line without the./
in front?find
, you will get a warning if you use a global option like-maxdepth 1
after an argument like-type d
; it is now recommended to reverse the order tofind . -maxdepth 1 -type d