![]() |
Reading a specific Folder's file
Is there any way to read all files in a folder and output
the File name, Date & time, file type, etc. into a spreasheet? Thanks in advance! Jimmy |
Reading a specific Folder's file
Hi Jimmy
Run this with a empty sheet active Sub test2() Dim i As Long With Application.FileSearch .NewSearch .LookIn = "c:\Data" .SearchSubFolders = False .MatchTextExactly = False .FileType = msoFileTypeAllFiles If .Execute(msoSortOrderDescending) 0 Then MsgBox "There were " & .FoundFiles.Count & " file(s) found." For i = 1 To .FoundFiles.Count Cells(i, 1).Value = .FoundFiles(i) Cells(i, 2).Value = FileDateTime(.FoundFiles(i)) Cells(i, 3).Value = FileLen(.FoundFiles(i)) Next i Else MsgBox "There were no files found." End If End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Jimmy" wrote in message ... Is there any way to read all files in a folder and output the File name, Date & time, file type, etc. into a spreasheet? Thanks in advance! Jimmy |
Reading a specific Folder's file
Thanks!!! That worked..
-----Original Message----- Hi Jimmy Run this with a empty sheet active Sub test2() Dim i As Long With Application.FileSearch .NewSearch .LookIn = "c:\Data" .SearchSubFolders = False .MatchTextExactly = False .FileType = msoFileTypeAllFiles If .Execute(msoSortOrderDescending) 0 Then MsgBox "There were " & .FoundFiles.Count & " file (s) found." For i = 1 To .FoundFiles.Count Cells(i, 1).Value = .FoundFiles(i) Cells(i, 2).Value = FileDateTime(.FoundFiles (i)) Cells(i, 3).Value = FileLen(.FoundFiles(i)) Next i Else MsgBox "There were no files found." End If End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Jimmy" wrote in message ... Is there any way to read all files in a folder and output the File name, Date & time, file type, etc. into a spreasheet? Thanks in advance! Jimmy . |
All times are GMT +1. The time now is 01:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com