How would I modify this Excel VBA to:
- List the paths of the directories and not just the files?
- Filter out system and hidden files?
Here is the the current VBA:
Sub MM()
Dim fResults As Variant
fResults = GetFiles("C:\Temp")
Range("A1").Resize(UBound(fResults) + 1, 1).Value = _
WorksheetFunction.Transpose(fResults)
End Sub
// UDF to populate array with files, assign to a Variant variable.
Function GetFiles(parentFolder As String) As Variant
GetFiles = Filter(Split(CreateObject("WScript.Shell").Exec("CMD /C DIR """ & parentFolder & _
IIf(Right(parentFolder, 1) = "\", vbNullString, "\") & "*.*"" /S /B /A:-D").StdOut.ReadAll, vbCrLf), ".")
End Function
dircommand.