Returning Path of Files

jaynorman46

New Member
Joined
Apr 5, 2011
Messages
23
Hi,

I have over 15,000 files on a file share. I am looking to try and extract the path for each individual one and paste it in a long list on a sheet with its associated folder. I'm having a hard time of where to start. the most difficult part is there are thousands of folders and different types of files as well. I have 35 master folders with sub folders within.



My eventual goal is to create an easy to access index on an excel sheet. Once I have all the Paths I can create Hyperlinks to the exact file for one click viewing.


Is this even possible?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
Maybe a start?

Code:
Sub ListFiles2()
Dim MyFolder As String
Dim MyFile As String
Dim j As Integer
With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
    .Show
    MyFolder = .SelectedItems(1)
End With
MyFile = Dir(MyFolder & "\*.xls")
Do While MyFile <> ""
    j = j + 1
    Cells(j, 1).Value = MyFile
    MyFile = Dir
Loop
End Sub
 

jaynorman46

New Member
Joined
Apr 5, 2011
Messages
23
Thanks for replying!

just for clarification I need to give myfolder a value? and can I do this with .pdf and .jpg?
 

jaynorman46

New Member
Joined
Apr 5, 2011
Messages
23
Ok, I see what the program you wrote does now. I dont want to be prompted for each folder. I have 1,463 folders to do this with is there anyway that this step could be automatic?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
You could create a list of folders on a sheet then loop through those values.

There is no 'magic' solution as far as I know.
 

Forum statistics

Threads
1,085,348
Messages
5,383,096
Members
401,815
Latest member
nube78

Some videos you may like

This Week's Hot Topics

Top