Finding Date of Folders

drsparks

New Member
Joined
Jul 20, 2010
Messages
3
I currently have a code that pulls the name, path, and size of a file from the directory. I need this code to also like the date range for the folder. (could be created to last modified). Below is the current code. any help would be appreciated.

Sub ListFoldersAndInfoSystemsFolder()
Dim FSO As Object
Dim Folder As Object
Dim FolderName As String
Dim R As Long
Dim Rng As Range
Dim SubFolder As Object
Dim Wks As Worksheet

FolderName = "I:\Systems\"

Set Wks = Worksheets("Sheet2")
Set Rng = Wks.Range("A2")
Wks.UsedRange.Offset(1, 0).ClearContents

Set FSO = CreateObject("Scripting.FileSystemObject")

Set Folder = FSO.GetFolder(FolderName)
R = Rng.Row
Rng.Cells(1, 1) = Folder.Name
Rng.Cells(1, 2) = Folder.Path
Rng.Cells(1, 3) = Folder.Size

For Each Folder In Folder.SubFolders
Rng.Cells(R, 1) = Folder.Name
Rng.Cells(R, 2) = Folder.Path
Rng.Cells(R, 3) = Folder.Size
R = R + 1
Next Folder

Set FSO = Nothing

Sheets("Sheet2").Select
Cells.Find(What:="Projects", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Selection.EntireRow.Delete


End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,415
Messages
6,119,375
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top