I've searched far and wide but can't seem to find the answer to this seemingly simple question!
I have a directory that contains some dotfiles (they happen to be .git
but the could easily be .svn
and maybe even something else) and some non-dotfiles. I'm searching for a general function that will list all subdirectories of this directory, except the ones beginning with a period .
.
I'm thinking it's some variant of find . -type d
but I've tried several incantations and come up short.
Something like
def find_files(listing, dir):
for entry in listdir(dir):
if isdir(entry) and does_not_begin_with_dot(entry):
listing.append(entry)
find_files(listing, entry)
(Surprised nobody's asked this - maybe there's a more bash-ish way that I'm not seeing?)
...or...