Jump to content

How to get path to a folder and then build the path to the files inside

Cameron Berns

Recommended Posts

I want to prompt the user to select the folder where the data of interest is located. Next, I want to extract all the files that end in .csv inside each seperate folder and build the data table. Lastly, I need to open another layer of folders and match the .jpeg names to a column in the previously built data table. Right now I can append and add the data tables but basically need help on how to build the file path from a multiselct of folders instead of .csv files.
Link to comment
Share on other sites

ofd = OpenFileDialog()

ofd.Multiselect = Trueif ofd.ShowDialog() == DialogResult.OK:

    files = ofd.FileNames

    files = list(files)

    print files # NOTE: it stores the files paths

    for x in ofd.FileNames:



        nlogs.Add(Path.GetFileName(x)) # NOTE: the Sysytem.IO .NET API is needed here** Right now this will print the file paths but I need to know how to start in a folder and then use reg ex. to navigate into each folder and populate the data table with the embedded "....csv" file(s).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...