Hi to all.
I use this simple code to find all the files in a folder or in a folder and sub folders.
I would like to know how can i bring also the attributes of these files
Thanks and regards.
I use this simple code to find all the files in a folder or in a folder and sub folders.
Excel Formula:
Private Sub GetFiles(ByVal Path As String)
Dim FSO As Object, Fldr As Object, subF As Object, File As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fldr = FSO.GetFolder(Path)
'Check in Subfolders
If Worksheets("Parm").Cells(2, 2).Value = True Then
For Each subF In Fldr.SubFolders
GetFiles (subF.Path)
Next subF
End If
For Each File In Fldr.Files
If LCase(Right(File.Path, Len(Worksheets("Parm").Cells(1, 2).Value))) = Worksheets("Parm").Cells(1, 2).Value Then
ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(, 5) = Array(File.Path, File.Name, File.Name, File.Size, File.DateCreated)
End If
Next File
Set FSO = Nothing
Set Fldr = Nothing
Set subF = Nothing
Set File = Nothing
Columns("A:AJ").AutoFit
End Sub
I would like to know how can i bring also the attributes of these files
Thanks and regards.