O__dirToArray
Purpose: Turns the contents of a directory (subdirectories & files) into an array. It ignores "." and "..". It is not recursive.
Type: Server-side function
Inputs:
- $O__directoryPath: The path to the directory to be audited.
Outputs: A two-dimensional array is returned. The first dimension is the file or directory name. The second dimension indicates whether it is a directory or file, through the use of "d" or "f".
Use Case: Call O__dirToArray whenever you need to produce a list of directory contents to be targeted for other uses. The desired end results may be to simply get a list of all files (excluding directories) or all directories (excluding files). In these cases, once O__dirToArray provides an array, further manipulate the array to parse out the needed directories or files by evaluating the "d" or "f" values in the second dimension.
Examples:
- Get contents of a directory: $myDirectoryArray = O__dirToArray("/path/to/my/directory");
Version Documented: 20180409