Skip to main content
Question

How to select a latest modified date SDF file in a folder?


Forum|alt.badge.img

Hello,

I have a folder which contains many sdf files with different "last modified date" and file names. In my FME script, i'm only interested to READ the latest sdf file (1 file). May I ask how to select that file?

thank you.

2 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • December 7, 2015

You can use a Directory and Filepathnames reader. Then sort the data on path_modified_date.

Then use the Sampler to get the latest modification.


tim_wood
Contributor
Forum|alt.badge.img+8
  • Contributor
  • July 20, 2018
erik_jan wrote:

You can use a Directory and Filepathnames reader. Then sort the data on path_modified_date.

Then use the Sampler to get the latest modification.

I wanted the modified date of the Personal Geodatabase I'm reading a Feature Class from so I used your suggestion but with a Path Filter of the PGDB file name rather than the Sampler. Now I'm just working on making that date an attribute of all the features in the Feature Class...

 

Update: figured out a way:

 

I use the Counter on the Feature Class data to create values (_count) that will match the Cloner output (_copynum). These are the join fields in FeatureJoiner_4.

 

 

Both AttributeCreators create an attribute called _join_id with a value of 1 so the date modified will be merged with the Summary feature from the StatisticsCalculator (thanks to https://knowledge.safe.com/questions/5293/how-to-count-the-number-of-features-with-the-same.html).

 

 

Cloner uses the Total Count from StatisticsCalculator to create the required number of copies.

 


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