Function FilesIn_Array(folderPath)
Dim fso As Object
Dim sourceFolder As Object
Dim file As Object
Dim filePaths() As String
Dim i As Integer
Set fso = CreateObject("Scripting.FileSystemObject")
Set sourceFolder = fso.GetFolder(folderPath)
' Set the size of the array based on the number of files in the folder
ReDim filePaths(sourceFolder.Files.Count - 1)
i = 0
' Retrieve the file paths in the folder
For Each file In sourceFolder.Files
filePaths(i) = file.Path
i = i + 1
Next file
FilesIn_Array = filePaths
End Function
Function FoldersIn_Array(folderPath)
Dim fso As Object
Dim sourceFolder As Object
Dim file As Object
Dim filePaths() As String
Dim i As Integer
Set fso = CreateObject("Scripting.FileSystemObject")
Set sourceFolder = fso.GetFolder(folderPath)
' Set the size of the array based on the number of files in the folder
ReDim filePaths(sourceFolder.subFolders.Count - 1)
i = 0
' Retrieve the file paths in the folder
For Each file In sourceFolder.subFolders
filePaths(i) = file.Path
i = i + 1
Next file
FoldersIn_Array = filePaths
End Function
Dim fso As Object
Dim sourceFolder As Object
Dim file As Object
Dim filePaths() As String
Dim i As Integer
Set fso = CreateObject("Scripting.FileSystemObject")
Set sourceFolder = fso.GetFolder(folderPath)
' Set the size of the array based on the number of files in the folder
ReDim filePaths(sourceFolder.Files.Count - 1)
i = 0
' Retrieve the file paths in the folder
For Each file In sourceFolder.Files
filePaths(i) = file.Path
i = i + 1
Next file
FilesIn_Array = filePaths
End Function
Function FoldersIn_Array(folderPath)
Dim fso As Object
Dim sourceFolder As Object
Dim file As Object
Dim filePaths() As String
Dim i As Integer
Set fso = CreateObject("Scripting.FileSystemObject")
Set sourceFolder = fso.GetFolder(folderPath)
' Set the size of the array based on the number of files in the folder
ReDim filePaths(sourceFolder.subFolders.Count - 1)
i = 0
' Retrieve the file paths in the folder
For Each file In sourceFolder.subFolders
filePaths(i) = file.Path
i = i + 1
Next file
FoldersIn_Array = filePaths
End Function
folderPath
Views 141
Downloads 83
CodeID
DB ID