Solved

Restricting file types read when using a generic reader to read data from a ZIP file

  • 19 November 2021
  • 2 replies
  • 4 views

Badge +2

I have a bunch of ZIP files which we download the contain data in 3 formats, shape, csv and file gdb. The zips also contain numerous other files such as pdf and xml, which we don't need to read.

 

Now the tricky bit, I am using a PATH reader to check a directory to see what ZIPs are there and to only load the ones that have arrived in the last 24hrs. The load is triggered in a Sub workbench where the Path is passed to a FeatureReader set to Generic. I can add I file type filter to the path that is passed by adding [**\\*.shp], for example to the path of the zip found by the PATH reader and can read the ZIP 3 times with a different filter each time by building this string

""@Value(path_windows)[**\\*.shp]" "@Value(path_windows)[**\\*.csv]" "@Value(path_windows)[**\\*.shp]""

 

but can't work out how to add filters for csv and gdb to read the file once and look for shp, csv or gdb.

 

The above works, but I get error messages for the iterations that don't find the file type filtered for, which is messy.

 

I could hard code the file type for each file, but want to future proof for possible changes in the future

icon

Best answer by ebygomm 19 November 2021, 09:41

View original

2 replies

Userlevel 1
Badge +21

I think this should work here

"@Value(path_windows)\**\*.{shp,csv,gdb}"

 

Badge +2

I think this should work here

"@Value(path_windows)\**\*.{shp,csv,gdb}"

 

Thanks @ebygomm​ , I knew there was some way to specify more that one extension, though I found I had to add the square brackets as well

@Value(path_windows)[**\*.{shp,csv,gdb}]

Reply