cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
StarfruitBob
Level VI

Multiple File Import, file filtering

Hello everyone,

 

JSL newbie here! I need to Import Multiple Files, where the file names that are imported have some parameters that need to be met.

 

  • Cannot contain certain characters.  These characters are always at the end of the file name.
  • Must include a certain string
  • If there are identical string segments within the file names found, only the one with the most recent system date & time stamp are imported. I need a way to chop up and compare parts of file names.

 

Ex: I want all fruit smoothie drinks containing “Apple”, but not “Tomato”. (file name, date & time YYYYMMDD HHMM)

 

Kiwi_Apple_Mango.csv                                            20220125 1421

Apple_Grape_Kiwi.csv                                              20220125 1243

Durien_Tomato.csv                                                  20220126 1607

Apple_Grape_Kiwi_Tomato.csv                              20220126 1537

Mango_Banana_Durien.csv                                     20220126 0915

Grape_Pineapple_Apple_Avocado.csv                   20220126 0711

Apple_Grape_Kiwi.csv                                              20220127 1111

 

The naming of the files does have structure.  The string I’m looking for is after multiple delimiters.

 

Additional asks

  • Are there any tips for speeding up the search for these files in a folder where many thousands of files are stored?  I can only filter by extension after the initial search. Currently, it takes many minutes to even search and find all the files in this folder.
  • Any tips for importing a growing number of files? The number of imported files will likely top 1000 in a few months.  All of them have the same data structure.  I’m aware I need to “Stack Similar Files”.  These are all data tables.

 

I’ve looked up the functions Words and Munger, but I’m not sure they’re what I need to complete the file import script.

Learning every day!
12 REPLIES 12
StarfruitBob
Level VI

Re: Multiple File Import, file filtering

 Thank you!  The Contains Item with Pat Regex seems to do the trick!

Learning every day!
Kay8735
Level I

Re: Multiple File Import, file filtering

Hi, i can,t figure out how if i want to exclude any filename with tomato during MFI. How can I set the name filter at MFI. thanks for help

StarfruitBob
Level VI

Re: Multiple File Import, file filtering

When I add in !Contains(part, "Tomato") or Contains(part, "Apple"), the script is stuck looping discovery of the files in the folder I'm searching. The data import never actually happens. Any thoughts on why this is happening?

 

I'd copy the code here, but it's constantly being reported as spam for some reason

Learning every day!