Sorting input files by special file time

When your business logic relies on a certain order to read the input files, you configure scanning of the directory to report the identified files in a sorted sequence. For example, this sorting is needed in automated tests where current application results are automatically compared to expected results.

About this task

Enable sorting by special file time in ascending order by using parameters. Here special file time means that the date and time information is encoded in the file name.

Procedure

  1. In the file <PathToYourApplication>/config/config.cfg, find the ite.ingest.directoryScan.sort parameter description
  2. To enable sorting in ascending order, select the ascending value to the parameter as follows: ite.ingest.directoryScan.sort=ascending

  3. In the file <PathToYourApplication>/config/config.cfg, find the ite.ingest.directoryScan.sort.attribute parameter description

  4. To enable sorting by special file time, set the parameter as follows: ite.ingest.directoryScan.sort.attribute=time

  5. In the file <PathToYourApplication>/config/config.cfg, find the ite.ingest.directoryScan.specialFileTime parameter description

  6. To enable special file time processing, set the parameter to on as follows: ite.ingest.directoryScan.specialFileTime=on

  7. In the file <PathToYourApplication>/config/config.cfg, find ite.ingest.directoryScan.specialFileTime.regexp parameter description

  8. Set the parameter to a regular expression, which extracts the date and time information from the file name, for example: ite.ingest.directoryScan.specialFileTime.regexp=.*_([0-9]{8}).txt$

  9. In the file <PathToYourApplication>/config/config.cfg, find the ite.ingest.directoryScan.specialFileTime.format parameter description

  10. Set the parameter to a date format string to interpret the cut out date and time information, for example: ite.ingest.directoryScan.specialFileTime.format=YYYYMMDD

For the latter two parameters, you can assign a comma-separated list of regular expressions and appropriate format strings to support many different file names.