Best practice for picking up and moving a file that has a file spec of yesterday's date?

Primary tabs


I am using EnsLib.RecordMap.Operation.FileOperation to write a daily file with the name %Y%m%d.txt so that every day I will have one file as that day's date and a .txt extension. 


What I want to do is every morning around 1am or so, use EnsLib.RecordMap.Service.BatchFileService to pick up that recently completed file. 


Can you use operands in the File Spec field? I am assuming that %Y%m%d-1.txt will not work.


Thanks in advance.

  • 0
  • 0
  • 92
  • 2
  • 1


No, you can't use operands for date math with the "stock" file business service.

I'm assuming that you want to guarantee that only completed txt files are picked up by the business service. In that case, you'll probably want to use the EnsLib.RecordMap.Operation.BatchFileOperation Business Operation class, and update your Record Map to include (and generate) an "empty" batch class.

You can then specify an intermediate file path in the operation's config that will hold the current day's records until the rollover schedule criteria is met. At the scheduled time, the accumulated records in the intermediate file path will be moved to the destination file path and name specified in the config.

Batch class definition:

Sample configuration for EnsLib.RecordMap.Operation.BatchFileOperation, with additional settings required to enable batch rollover:

Thank you so much again Jeffrey you have really helped me out.

You're welcome, but the best way to thank me is to click the "Accepted Answer" button laugh