Displaying FileSize

D

Dennis

I'm able to list all file on my drive with ...

Sub MyFiles()

With Application.FileSearch

.LookIn = "C:\"
.FileType = msoFileTypeAllFiles
.SearchSubFolders = True
.Execute

End With

cnt = Application.FileSearch.FoundFiles.Count

For i = 1 To cnt

rng = "A" & i

Range(rng).Value = Application.FileSearch.FoundFiles.Item(i)

Next i

End Sub

I would also like to display the file size after each file, preferable 10
cells to the right of the file name.

TIA,
Dennis
===================
 
V

Vasant Nanavati

Try:

Range(rng).Offset(, 10).Value =
FileLen(Application.FileSearch.FoundFiles.Item(i))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top