How can I get all sub-directories of a given directory without files, .(current directory) or ..(parent directory)
and then use each directory in a function?
How can I get all sub-directories of a given directory without files, . (current
Share
Option 1:
You can use
glob()with theGLOB_ONLYDIRoption.Option 2:
Another option is to use
array_filterto filter the list of directories. However, note that the code below will skip valid directories with periods in their name like.config.