Multiple files in directory and subdirectory

I’m new at EM. I need to import CSV’s from multiple subdirectories that branch off primary directory. This doesn’t seem possible.

Hello Douglas and welcome to the Community!

To import multiple CSVs from multiple subdirectories:

  1. Create a parameter “Directory” for a directory path.

  2. Use the “List of files” action to produce a list of CSV files in the directory specified by the parameter. See this tutorial article on how to create parameters and use them in actions: https://easymorph.com/learn/parameters.html

  3. Use the “Import delimited text file” in the “Load list of files” mode to import the CSV files produced in the 2nd step above. See this tutorial article for more details: https://easymorph.com/learn/load-file.html

    At this point, your workflow can read all CSV files in one directory specified by a parameter. Let’s continue and improve the workflow to make it read files from multiple directories.

  4. Create a new module. See here the tutorial article on modules: https://easymorph.com/learn/subprojects.html

  5. In the new module, add to a new table the “List of folders” action to produce a list of subdirectories with CSV files in the primary directory

  6. Add the “Iterate” action to create an iteration (loop) that will go across the list of subdirectories and call the default module and assign its “Directory” parameter with subdirectories from the list. Use the “Iterate and append” mode in the action to concatenate all the loaded files into one table. This tutorial article explains iterations in EasyMorph: https://easymorph.com/learn/iterations.html

The workflow described above may look complex for a beginner, but it’s actually rather simple once you learn how to design iterations in EasyMorph. The workflow only requires 4 actions total in 2 modules. If you need a working ready-to-use example, let me know.

Hi! I was wondering if you have an example I could follow? I'm a newbie at this.

image

This should be what you're looking for. Just make sure you select the Subfolders option at the bottom. I'm not sure how deep your subfolders go, but adjust the depth until you have all you need.

2 Likes