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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- how to split a list into a given number of sub-lis
- Can php detect if javascript is on or not?
Find all the files and folders under a specified directory.
Sample :
Try this code:
If you're looking for a recursive directory listing solutions. Use below code I hope it should help you.
For the people who actually want folders and subfolders with no files, just like the OP said, the following code outputs both a list of folders and their subfolders, and an array of the same.
The following recursive function returns an array with the full list of sub directories
Source: https://www.lucidar.me/en/web-dev/how-to-get-subdirectories-in-php/