--- title: "Dynamic File Naming Patterns" slug: "dynamic-file-naming-patterns" description: "Utilize dynamic file naming patterns and partitioning in Dataddo to automatically locate source files and generate organized output files for data flows." updated: 2025-07-24T18:38:56Z published: 2025-07-24T18:38:56Z canonical: "docs.dataddo.com/dynamic-file-naming-patterns" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.dataddo.com/llms.txt > Use this file to discover all available pages before exploring further. # Dynamic File Naming Patterns Dataddo supports **dynamic file naming** when creating ***{{glossary.data source}}s*** and ***{{glossary.data flow}}s***, giving you control over how files are created using variables like dates or object identifiers. Depending on the use case, this feature serves two purposes: * **File Naming Patterns**: Used when configuring ***data sources*** to locate and extract the correct input file. * **File Partitioning**: Used in ***data flows*** to organize output data into multiple files based on time or other variables. ## File Naming Patterns (for Data Sources) When setting up a **file-based data source** (e.g., from [Microsoft OneDrive as a Source](/docs/microsoft-onedrive-source){target=`_blank`}), you can define a dynamic file name to automatically match files that update daily or periodically. This is ideal for systems that generate a new file each day and can embed the date in the file name. ### Dynamic Variables for Sources Below, you will find all supported dynamic variables for ***data sources***. |Variable |Description| |---|---| |{{today}}| Current date | |{{yesterday}}| Previous day’s date| You can change the date format using [date string formatting](/docs/dynamic-file-naming-patterns#date-string-formatting), e.g.: * `{{today|Y-m-d}}` → `2020-01-31` * `{{yesterday|d_m_Y}}` → `31_01_2020` **Example** For a file name like `sales_data_20200101.csv`, you can use the following name pattern: ``` sales_data_{{today|Ymd}}.csv ``` ## File Partitioning (for Data Flows) File partitioning splits large datasets into smaller, manageable partitions, based on criteria like date. This technique enhances data organization, query performance, and management by grouping subsets of data with shared attributes. When configuring a data flow that outputs data to a **file-based destination** (e.g., [SFTP Server](/docs/sftp-server){target=`_blank`} or [Microsoft OneDrive](/docs/microsoft-onedrive){target=`_blank`}), you can define a custom file name pattern to partition the output. **Example** You can use either [**dynamic variables**](/docs/dynamic-file-naming-patterns#dynamic-variables-for-flows) or [**dynamic date ranges**](/docs/dynamic-file-naming-patterns#dynamic-date-range-for-flows) in your file names and change the the date format using [date string formatting](/docs/dynamic-file-naming-patterns#date-string-formatting), e.g.: * `{{today|Y-m-d}}` → `2020-01-31` * `{{yesterday|d_m_Y}}` → `31_01_2020` * `xyz_{{1d1|Ymd}}` → `xyz_20200131` ### Dynamic Variables for Flows Below, you will find all supported dynamic variables for ***data flows***. |Variable |Description| |---|---| |{{today}}| Current date | |{{yesterday}}| Previous day’s date | |{{dateRangeStart}}| Start date of selected range | |{{dateRangeEnd}}| End date of selected range | |{{objectId}} |ID of the processed object | |{{objectLabel}} |Label or name of the processed object | ### Dynamic Date Range for Flows Use expressions like `{{1m1}}` (last month) or `{{90d1}}` (90 days ago through yesterday) to define **custom ranges**. The syntax `{{}}` breaks down as: 1. **Start**: Number of units back from today (e.g., `1` month ago). 2. **Unit**: `d`=day, `w`=week, `m`=month, `y`=year. 3. **End**: Number of units back marking the range’s end (must be ≤ start). | Expression | Meaning in ISO 8601 | |---------------------|-----------------------------------------| | {{0d0}} | Today | | {{1d1}} | Yesterday | | {{1d0}} | Yesterday and today | | {{0m0}} | This month | | {{1m1}} | Last month | | {{90d1}} | 90 ago until yesterday | | {{1w1}} | Last week | | {{0w0}} | This week starting from Monday | | {{0y0}} | This year | | {{1y1}} | Last year | | \{\{1d1\|U\}\} | Yesterday in Unix seconds | ## Date String Formatting Specify the **date string format** used in your dynamic file name by applying standard [strftime](https://strftime.org/){target=`_blank`} patterns. This determines how the date appears when inserted into the file name. | Expression | Output | | --- | --- | | {{0d0\|Ymd}} | 20201231 | | {{0d0\|Ydm}} | 20203112 | | {{0d0\|d/m/Y}} | 31/12/2020 | | {{0d0\|Y-m-d}} | 2020-12-31 | | \{\{0d0\|Y-m-d\\TH:i:s\}\} | 2020-12-31T00:00:00 | | {{0d0\|U}} | 1698403939 |