I want to get a list with just folders (without subfolders). Any idea how to do that ???

I'm sure you can use os.walk
and it yields a 3-tuple (dirpath, dirnames, filenames)

Well you could always do something like this ..

def ListFolders(YOUR_PATH):
    for path i os.listdir( YOUR_PATH ):
        if not os.path.isfile( os.path.join( YOUR_PATH, path) ):
            yield path

That would get you a list of folders , without the files ..

Not really sure if that's what you wanted tho :\

import os
for x in os.listdir(''):
    if os.path.isfile(x): pass
    else: print(x)

^ The above is for printing only folders.

import os
for x in os.listdir(''):
    print(x)

^ Above code is for printing all folders/files in the directory. No subdirectories

import os
for x in os.listdir(''):
    if os.path.isfile(x): pass
    else: print(x)

^ The above is for printing only folders.

import os
for x in os.listdir(''):
    print(x)

^ Above code is for printing all folders/files in the directory. No subdirectories

Thanx, worked as i wanted to. :)