Question

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


Badge +3

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

Userlevel 6
Badge +32

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.
Badge +3

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.

Userlevel 6
Badge +32

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.

Reply