Import Files from FTP with Dynamic File Names

In this tutorial, we will learn how to import a file from FTP when the file name changes.

Case 1: File Name Depends on the Date

Some suppliers upload a new file to FTP every day. The file name contains the current date.

Example:

  • Today (30 August 2022): /files/products-30-08-2022.csv
  • Tomorrow (31 August 2022): /files/products-31-08-2022.csv

To avoid editing the file path every day, you can use patterns for the file name.

Example pattern:

/files/products-{d-m-Y}.csv

Where:

  • d = current day (01–31)
  • m = current month (01–12)
  • Y = year (4 digits, e.g., 2022)

So on 30 August 2022, the system will automatically read the file: /files/products-30-08-2022.csv

Important: The app uses the GMT timezone to calculate the current date.

👉 You can find the full list of available date/time format characters in the table below.

Case 2: Unknown File Name

Sometimes the file name may not contain a predictable date, but instead has random or changing numbers.

Example:

  • Today: /files/products-123.csv
  • Tomorrow: /files/products-456.csv

Here, only part of the name is stable (products-), while the rest changes.

In this case, you can use the special wildcard pattern [*], which means "any value".

Pattern example:

/files/products-[*].csv

This tells the app to:

  • Look in the folder /files
  • Find a file that starts with products-
  • And ends with .csv

Result: The app will automatically detect and import the correct file each day without you needing to change the path manually.

Examples of FTP File Patterns

  • /files/pricelist-{Y}{m}{d}.csvpricelist-20220830.csv
  • /files/products-{d-m-Y}.csvproducts-30-08-2022.csv
  • /feeds/feed-week-{W}.xmlfeed-week-35.xml
  • /files/products-[*].csv → Matches any file starting with "products-"

Why Use FTP Patterns?

  • Save time – no manual editing of file paths.
  • Automation – always fetch the correct daily or weekly file.
  • Flexibility – supports both date placeholders and unknown parts of file names.