Skip to main content
Question

Can I use a reader to find a file name that changes depending on the date?


ruth_h
Contributor
Forum|alt.badge.img+4

Hi, I have an export process (non FME) from system that writes a file to a folder every day and gives that file a name depending on the date.  eg 2465_20210514_01.csv​.  I would like to set a scheduled job in FME to read the new file in every day and process an output from it.  Can I set up a reader in FME to pick a file based on a name that changes but with the same format (with the only change being date).  Many thanks.

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

Multiple ways to do this.

  • Create the filepath dynamically, feed this to the FeatureReader.
    • Pretty straightforward.
    • Attached a sample workspace.
  • Scan all files in the directory, parse the date from the filename and filter current date.
    • You might need to do this if the input is more flexible, like if the prefix and suffix are not fixed. Or multiple files each day.
    • This can be a lot slower if the directory contains a lot of files.
    • I prefer this one to because I prefer to be (feel like I am) in control.

ruth_h
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • May 17, 2021

Thank you very much for the quick reply. So of the second option "scan all files in the directory...." - is this something that can be done in FME? Thank you.


nielsgerrits
VIP
Forum|alt.badge.img+54
ruth_h wrote:

Thank you very much for the quick reply. So of the second option "scan all files in the directory...." - is this something that can be done in FME? Thank you.

Yes, this can be done with the "Directory and File Pathnames" reader.


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