Answers for "list directories using os"

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
0

python3 list directories

import os

arr = os.listdir("c:/temp/")

print("n".join(arr))
Posted by: Guest on August-15-2021

Browse Popular Code Answers by Language