Listing files in directories.

S

skmr3

Hi All.
I have this below coding to list all files in a directory.
However i need to modify the code to modify the code to
display the folder path along with the file name.
If possible as well, i need to modify the coding to also
list files located in sub-directories as well.
Any help would be greatly appreciated.
Cheers.
Skmr3.

Sub DisplayFilesInDirectory()
Dim fs, f, f1, fc, s
Dim Folder
Folder = "???"
Set fs = CreateObject("scripting.filesystemobject")
Set f = fs.GetFolder(Folder)
Set fc = f.Files
For Each f1 In fc
ActiveCell.Value = s & f1.Name
ActiveCell.Offset(1, 0).Activate
Next

End Sub
 

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