ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   List FullFilePath and File name (https://www.excelbanter.com/excel-worksheet-functions/128664-list-fullfilepath-file-name.html)

FrodeOlsen

List FullFilePath and File name
 
Folks,

There seems to be a number of people that have varuis scripts to list
filename with full path here. Hovever, it seems that this one is one
of tha fastest i have tried so far. The only problem is that i need
this to also include all "SubFolders" not just one folder.

How can that be done ?




Sub ListFiles02()
'Using FileSearch to list the files in a directory
Dim i As Integer
i = 1
With Application.FileSearch
..NewSearch
..LookIn = "C:\GTA\Loaded Drawings\"
..Filename = "*.*"
.SearchSubFolders = True
'.SearchFolders = False
..Execute
For i = 1 To .FoundFiles.Count
Range("B" & i + 1).Value = .FoundFiles(i)
Range("C" & i + 1).Value = FileDateTime(.FoundFiles(i))
'Range("D" & i+1).Value = FileLen(.FoundFiles(i))
Next


End With


End Sub



All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com