#!/usr/bin/env python3
# lists only the files in a directory which are also a directory
import os
import sys

def listdir(path):
    if not os.path.exists(path):
        raise ValueError("No such directory: "+path)
    elif not os.path.isdir(path):
        raise ValueError(path+" is not a directory")
    filenames = os.listdir(path)
    filenames.sort()
    for filename in filenames:
        filepath = os.path.join(path, filename)
        if os.path.isdir(filepath):
            print(filepath)

if len(sys.argv) > 1:
    for arg in sys.argv[1:]:
        listdir(arg)
else:
    listdir('.')
