I'm looking for a way to list the sub-directories contained with the current working directory, however, I haven't been able to find a way that doesn't iterate over all files.
Essentially, if I have a folder with a large number of files and 2 folders, I want a method that can quickly return a list containing the names of the 2 folders without having to scan all of the files, too.
Is there a way to do this in Python?
Edit: I should clarify, that my question is in regards to the performance of retrieving the directories. I already know of several ways to get the directories, but they're all slowed down if the working directory has a bunch of files in it as well.