Answers for "list only directories"

1

list only directories

# List directories under the current working directory.
ls -l | grep "^d"

# List directories under the current working directory and 
# include hidden folders
ls -la | grep "^d"
Posted by: Guest on October-09-2020
9

linux list directories

ls -d */
Posted by: Guest on June-15-2020
2

python list directories only

>>> [ name for name in os.listdir(thedir) if os.path.isdir(os.path.join(thedir, name)) ]
['ctypes', 'distutils', 'encodings', 'lib-tk', 'config', 'idlelib', 'xml', 'bsddb', 'hotshot', 'logging', 'doc', 'test', 'compiler', 'curses', 'site-packages', 'email', 'sqlite3', 'lib-dynload', 'wsgiref', 'plat-linux2', 'plat-mac']
Posted by: Guest on August-21-2020
0

how to filter directory in linux

#directory structure:
    - G10
    - G11
    - G12
    - thisDir
    
#command to enter to filter for all the G?? directories:
	ls -d G??
    
#entering this will return:
    - G10
    - G11
    - G12
Posted by: Guest on September-29-2020

Code answers related to "list only directories"

Browse Popular Code Answers by Language