Skip to main content
Question

Testing if a Directory contains relevant files

  • October 30, 2020
  • 3 replies
  • 151 views

hlouie
Contributor
Forum|alt.badge.img+15

The directory starts fresh every time, files copied are and produced by other FME Workbenches, testing condition whether a directory contains a 1-1000 files. I'm found and filter for the required files via FeatureReader Path but having a hard time testing for specific condition, Tester before a ListBuilder or a ListBuilder then a ListSearcher ???

 

PASSED condition if the directory

Must find = const.dwg, exist.dwg, passed.kmz

MUST BE NOT FOUND = failed.kmz

 

FAILDED in all other conditions

Found = const.dwg

Found = const.dwg, existing.dwg

Found = const.dwg, existing.dwg, failed.kmz

Found = const.dwg, existing.dwg, failed.kmz, passed.kmz

...

..

.

 

Testing for files

3 replies

Forum|alt.badge.img+2

There is a custom transformer to check for existing files. A couple of those might work fairly well.

 

https://hub.safe.com/publishers/safe-lab/transformers/fileexistencechecker


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • November 1, 2020

There are a couple of ways:

1. Join all the File Paths into one concantenated string, and run Tester "If ... AND ... AND ... AND ... AND" conditions over the concantenated value.

2. Use FME Transformers as Logic Gates. Eg. Sampler can be used for OR conditions, and FeatureJoiner can be used for AND conditions. In this case they are all AND or NOT AND conditions, so only FeatureJoiner is needed to find if TRUE or FALSE comes out, represented by either a single Feature on the Joined or Unjoined Ports

Both examples shown below:

 

First a "FAIL" with "failed.kmz" being present. No "PASS" features are produced

capture..and with the same workspace run, but this time with no "failed.kmz" present, this gives a "PASS" condition

capture2 


hlouie
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • November 3, 2020

After getting a list of list of relevant file -> ListBuilder -> AttributeValidatorAttributeValidator


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings