File name matching

This guide explains how to import a file whose name changes with each export, for example when your system adds a date or timestamp to every file it creates. Instead of a fixed file name, you enter a pattern. On each run, the import finds the files that match and imports one of them.

Where you can use it

Dynamic file matching is available for Data hub imports into item collections and Data hub catalogs.

Customer, event, and voucher imports use data imports, which have their own file matching options.

How matching works

When an import runs, it lists the files in the parent directory and checks each file name against your pattern:

  • File names only: The pattern is checked against the file name, not the folder path. Files in subfolders aren't included.
  • Anywhere in the name: A pattern matches if it appears anywhere in the file name. For example, daily matches prefix_daily_2026-10-13.csv. To match the whole name, start the pattern with ^ and end it with $.
  • Case-sensitive: feed doesn't match Feed_2026.csv. To ignore the letter case, start the pattern with (?i).
  • One file per run: If more than one file matches, the selection rule decides which one is imported.

Set up dynamic file matching

  1. Create or edit a file storage import.
  2. In Path to parent directory, enter the folder that contains your files.
  3. Under File matching, select Dynamic.
  4. Enter your pattern without enclosing slashes, for example ^catalog_\d{4}-\d{2}-\d{2}\.csv$.
  5. Choose a Selection rule.
  6. Click Preview data. The preview shows which file was selected, so you can check that the pattern and selection rule pick the file you expect.

If the pattern isn't valid, the import can't be saved, and an error message shows which part to fix.

Write a pattern

Patterns use RE2 regular expression syntax.

  • Don't add enclosing slashes, such as /feed.csv/. The import can't be saved with slashes in the pattern.
  • Escape dots as \.. An unescaped . matches any character, so catalog.csv also matches catalog_csv.
  • Lookaheads (?=…), lookbehinds (?<=…), and backreferences such as \1 aren't supported.

Examples

Files in the parent directoryPatternSelection ruleImported file
catalog_2026-10-12.csv, catalog_2026-10-13.csv, readme.txt^catalog_\d{4}-\d{2}-\d{2}\.csv$Last alphabeticallycatalog_2026-10-13.csv
Feed_upper.csv, feed_upper.csv(?i)^feed_upper\.csv$Last alphabeticallyfeed_upper.csv (lowercase sorts after uppercase)
prefix_daily_2026-10-13.csv, weekly_report.csvdailyLast modifiedprefix_daily_2026-10-13.csv
products_export_8812.csv (uploaded first), products_export_8813.csv (uploaded last)^products_export_\d+\.csv$Last modifiedproducts_export_8813.csv

Choose a selection rule

If more than one file matches your pattern, the selection rule decides which file is imported:

  • Last modified: Imports the file with the most recent modification time on the server. Use this rule when the newest upload is always the one you want. It's the recommended rule for full feeds.
  • Last alphabetically: Imports the file that comes last when the matching names are sorted alphabetically. Use this rule when the file name shows which file is newest, for example with a date in the name.
📘

Note

Last alphabetically compares file names character by character, so feed_9.csv comes after feed_10.csv. To keep the order correct, pad numbers with leading zeros (feed_09.csv) and write dates as year, month, day (2026-10-13).

What happens on each run

  • A file matches: The selection rule picks one file, and the import runs on that file.
  • No file matches: The run fails, and you get a failure notification. Your item collection or catalog isn't changed. This applies to scheduled runs and manual runs.
  • The same file is still the newest match: The import doesn't keep a record of the files it has already imported, so it imports the same file again. To avoid this, move each file out of the parent directory after it's imported, for example to an archive subfolder. Files in subfolders aren't matched, so they aren't picked up again.

To stop using a pattern, switch File matching back to Fixed and enter the exact file name. The import then uses only that file.

Limitations

  • Each run imports one file. Importing several matching files in one run isn't available.
  • Imports start on a schedule. Starting an import automatically when a new file is uploaded isn't available yet.
  • The parent directory path is static. It can't contain a pattern.
  • Files in subfolders aren't matched.
  • The import doesn't track which files it has already imported.

Move a pattern from a legacy catalog import

If you're recreating a legacy catalog import in Data hub, check your file name pattern before you copy it over:

Legacy catalog importsData hub importsWhat to do
New file uploaded triggerNot available yetUse a repeated schedule.
Remembers imported filesDoesn't track imported filesMove imported files out of the parent directory, or make sure a new file is in place before each scheduled run.
Selection rules: All, Last modified, Last alphabetically, Not imported yetLast modified, Last alphabeticallyIf you used All or Not imported yet, choose the rule that picks the file you need.
Supports lookaheads, lookbehinds, and backreferencesRE2 syntax doesn't support themRewrite the pattern without them.
The pattern is enclosed in slashes: /catalog_[0-9]+\.csv/No slashes: catalog_[0-9]+\.csvRemove the slashes.

Related articles


Did this page help you?

© Bloomreach, Inc. All rights reserved.