Skip to content

How the Blober file_dir Path Template Variable Really Works

· 5 min read · Updated

How the file_dir path template variable preserves relative folders in Blober

{file_dir} is the folder path between the source folder you selected and the file. It is not the file's full path, and it equals the file's parent folder only when the file sits one level below the selected folder.

Blober works it out as it scans the files inside a folder you selected:

file_dir = directory containing the file - selected folder path

In a custom path template, this value is what keeps nested source folders at the destination.

Where you use it

In a workflow:

  1. Open Source Configuration.
  2. Click Browse Files and Folders.
  3. Select a folder and submit the selection.
  4. Complete Destination Configuration.
  5. Expand Advanced Path Template (Optional).
  6. Add {file_dir} to the Template Pattern.

The usual template for keeping folders is:

{file_dir}/{filename}

When {file_dir} is empty, the result is just the filename. When it has a value, the nested folders come first. Blober drops the empty segment, so the path never starts with a slash.

Case 1: You select an individual file

Selected item:

Clients/Acme/Final/report.pdf

You picked the file itself, so there is no selected folder to measure from. Its relative directory is null, which becomes an empty {file_dir}.

Template: {file_dir}/{filename}
Result: report.pdf

Blober does not fill in the original parent path for a directly selected file, so you will not get:

Clients/Acme/Final/report.pdf

This matters when you select several files from different folders. A {file_dir}/{filename} template will not recreate each file's parent folder. To keep those folders, select the folders that contain the files.

Case 2: You select a folder and the file is at its root

Selected folder:

Shoots/Wedding-2026

File:

Shoots/Wedding-2026/cover.jpg

The file sits directly in the selected folder, so the relative path between them is empty.

{file_dir} = ""
Template: {file_dir}/{filename}
Result: cover.jpg

{file_dir} does not include the selected folder's name, Wedding-2026. The selected folder is the boundary, and the relative path starts inside it.

To get the folder name at the destination, add it as static text:

Wedding-2026/{file_dir}/{filename}

or select the parent folder Shoots, which moves the boundary up one level.

Case 3: You select a folder and the file is nested

Selected folder:

Shoots

Nested file:

Shoots/Wedding-2026/Camera-A/RAW/DSC_4821.ARW

The folders between the selected folder and the file are:

Wedding-2026/Camera-A/RAW

So:

{file_dir} = Wedding-2026/Camera-A/RAW

and:

Template: originals/{file_dir}/{filename}
Result: originals/Wedding-2026/Camera-A/RAW/DSC_4821.ARW

{file_dir} can span several levels. It holds every folder between the selected folder and the file.

Selection changes the result

The same file gets a different {file_dir} depending on what you select as the source.

File:

Archive/2026/Client-A/Final/video.mp4
Selected source {file_dir}
The file itself empty
Archive/2026/Client-A/Final empty
Archive/2026/Client-A Final
Archive/2026 Client-A/Final
Archive 2026/Client-A/Final

Blober treats the folder you select as the root and does not repeat it at the destination.

Why file_dir matters with custom templates

Without a custom template, Blober can keep subdirectories automatically when Include Subdirectories is enabled. Entering a custom template replaces that automatic path. Take this template:

by-date/{file_created_date}/{filename}

Every matching file is grouped by date, and the source subfolders disappear from the destination path.

To group by date and keep the relative folders:

by-date/{file_created_date}/{file_dir}/{filename}

For:

Selected folder: Projects
File: Projects/Acme/Final/report.pdf

the result is:

by-date/2026-07-18/Acme/Final/report.pdf

Mixed file and folder selections

Blober accepts several source selections in one workflow, for example one folder and a few individual files. Their {file_dir} values differ:

  • Files found inside the folder get the relative path below that folder.
  • Directly selected files get an empty value.
  • Files at the selected folder's root also get an empty value.

If every file needs a meaningful folder at the destination, don't combine individual files with a template that depends only on {file_dir}. Select common parent folders, or add a prefix that always has a value, such as {file_ext} or {file_created_date}.

Useful templates

Preserve the relative hierarchy:

{file_dir}/{filename}

Add an archive prefix:

archive/{file_dir}/{filename}

Split by type while preserving hierarchy:

{file_ext}/{file_dir}/{filename}

Group by creation date while preserving hierarchy:

{file_created_date}/{file_dir}/{filename}

Rename while preserving hierarchy:

{file_dir}/{file_created_datetime}_{filename}

Common mistakes

Expecting the selected folder's name to appear. {file_dir} starts below the selected folder, so the name is never in it.

Selecting individual files and expecting parent folders. A directly selected file has no selected folder to measure from, so its {file_dir} is empty.

Assuming Include Subdirectories adds folders to a custom template. A custom path expression takes precedence. Add {file_dir} yourself.

Using {file_dir} without {filename}. The variable holds folders only, so a template normally needs both.

Verify it in preview

Before you run a template on a large archive, try it on a small test tree:

Test/
  root.txt
  Level-1/
    nested.txt
    Level-2/
      deep.txt

Select Test and preview {file_dir}/{filename}. You should see these relative results:

root.txt
Level-1/nested.txt
Level-1/Level-2/deep.txt

Frequently asked questions

What does file_dir contain? The folders between the source folder you selected and the file. With Shoots selected, a file at Shoots/Wedding-2026/Camera-A/RAW/DSC_4821.ARW has a {file_dir} of Wedding-2026/Camera-A/RAW.

Why is file_dir empty? It is empty when you selected the file itself, or when the file sits directly in the selected folder.

Does file_dir include the name of the folder I selected? No. It starts inside that folder. Add the name as static text, such as Wedding-2026/{file_dir}/{filename}, or select the parent folder instead.

How do I keep my folder structure when I use a custom template? Put {file_dir} in the template, for example {file_dir}/{filename}. A custom template replaces the automatic subfolder path, so the folders only appear if the template asks for them.