Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Sub ListFiles()
Dim sPath As String
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select directory"
.InitialFileName = ThisWorkbook.Path & "\"
.AllowMultiSelect = False
If .Show = 0 Then Exit Sub
sPath = .SelectedItems(1) & "\"
End With
Application.ScreenUpdating = False
fSec = Timer
Do While col.Count
sPath = col(1)
On Error Resume Next
sFile = Dir(sPath, iAttr)
Do While Len(sFile)
sName = sPath & sFile
If Err.Number Then
' You can't get attributes for files with Unicode characters in
' the name, or some particular files (e.g., "C:\System Volume Information")
Debug.Print sName
Err.Clear
Else
On Error GoTo 0
If jAttr And vbDirectory Then
If Right(sName, 1) <> "." Then col.Add sName & "\"
Else
iFile = iFile + 1
If (iFile And &H3FF) = 0 Then
Application.StatusBar = sMsg(iFile, Timer - fSec, col.Count)
DoEvents
End If
iFile = iFile + 1
rOut.Range("A1:C1").Offset(iFile).Value = Array(sName, _
FileDateTime(sName), _
FileLen(sName))
End If
End If
sFile = Dir()
Loop
col.Remove 1
Loop