FileName, Size and TimeStamp
Closed
yelli
-
15 Apr 2010 à 09:09
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 15 Apr 2010 à 15:15
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 15 Apr 2010 à 15:15
Related:
- FileName, Size and TimeStamp
- Fc 24 pc download size - Download - Sports
- Mtu size - Guide
- Nfs most wanted 2005 size - Download - Racing
- Whatsapp timestamp - Guide
- How to change caption size on youtube pc - Guide
2 responses
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
15 Apr 2010 à 11:23
15 Apr 2010 à 11:23
It would be far easier to do so in VB script.
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
15 Apr 2010 à 15:15
15 Apr 2010 à 15:15
Insert this in a module of excel and execute TestListFilesInFolder. But before that change the value
sStartAtDir = "C:\Users\haadi\Desktop\"
sStartAtDir = "C:\Users\haadi\Desktop\"
Sub TestListFilesInFolder()
Dim sStartAtDir As String
sStartAtDir = "C:\Users\haadi\Desktop\"
With Range("1:1")
.Font.Bold = True
.Font.Size = 12
End With
Range("A1").Formula = "File Path:"
Range("B1").Formula = "File Name:"
Range("C1").Formula = "File Size:"
Range("D1").Formula = "File Type:"
Range("E1").Formula = "Date Created:"
Range("F1").Formula = "Date Last Accessed:"
Range("G1").Formula = "Date Last Modified:"
Range("H1").Formula = "Attributes:"
Range("I1").Formula = "Short File Path:"
Range("J1").Formula = "Short File Name:"
ListFilesInFolder sStartAtDir, True
End Sub
Sub ListFilesInFolder(SourceFolderName As String, Optional IncludeSubfolders As Boolean = False)
Dim FSO As Object
Dim SourceFolder As Object
Dim SubFolder As Object
Dim FileItem As Object
Dim lRowBeanCounter As Long
lRowBeanCounter = 2
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = FSO.GetFolder(SourceFolderName)
For Each FileItem In SourceFolder.Files
Cells(lRowBeanCounter, 1).Formula = FileItem.Path
Cells(lRowBeanCounter, 2).Formula = FileItem.Name
Cells(lRowBeanCounter, 3).Formula = FileItem.Size
Cells(lRowBeanCounter, 4).Formula = FileItem.Type
Cells(lRowBeanCounter, 5).Formula = FileItem.DateCreated
Cells(lRowBeanCounter, 6).Formula = FileItem.DateLastAccessed
Cells(lRowBeanCounter, 7).Formula = FileItem.DateLastModified
Cells(lRowBeanCounter, 8).Formula = FileItem.Attributes
Cells(lRowBeanCounter, 9).Formula = FileItem.ShortPath
Cells(lRowBeanCounter, 10).Formula = FileItem.ShortName
lRowBeanCounter = lRowBeanCounter + 1 ' next row number
Next FileItem
If IncludeSubfolders Then
For Each SubFolder In SourceFolder.SubFolders
ListFilesInFolder SubFolder.Path, True
Next SubFolder
End If
Columns("A:J").AutoFit
Set FileItem = Nothing
Set SourceFolder = Nothing
Set FSO = Nothing
End Sub
15 Apr 2010 à 13:02
how will you do such in VB Script?
thanks,
Yelli