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?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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
 
Upvote 0
Thanks for replying!

just for clarification I need to give myfolder a value? and can I do this with .pdf and .jpg?
 
Upvote 0
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?
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top