I have a folder with about 4000 files. They have names like
The numbers there are dates and times. So the above files would have 6 for July 1 2012 and 6 for July 2nd. I was starting by using a macro I found online but I realized it won't truncate the names of the files so that I would get just the dates (and not the times and not the text 'homes') in the list below. Can any suggest a macro for this?
I want to generate a list like
The macro I found is here. Also, I don't understand the use of arguments in macros and when I try to run this macro it brings up the list of all macros in my workbook which is strange.
Function GetDirOrFileSize(strFolder As String, Optional strFile As Variant) As Long
'Call Sequence: GetDirOrFileSize("drive\path"[,"filename.ext"])
Dim lngFSize As Long, lngDSize As Long
Dim oFO As Object
Dim oFD As Object
Dim OFS As Object
lngFSize = 0
Set OFS = CreateObject("Scripting.FileSystemObject")
If strFolder = "" Then strFolder = ActiveWorkbook.Path
If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\"
If OFS.FolderExists(strFolder) Then
If Not IsMissing(strFile) Then
If OFS.FileExists(strFolder & strFile) Then
Set oFO = OFS.GetFile(strFolder & strFile)
GetDirOrFileSize = oFO.Size
Set oFD = OFS.GetFolder(strFolder)
GetDirOrFileSize = oFD.Size
End Function '*** GetDirOrFileSize ***