Tinderbox v10 Icon

Export - name collision for created files

When exporting, if two files exported to the same folder location would have the same name, Tinderbox creates a synthetic name to avoid the collision.

For example, if two notes in the same container are both named "1", the first will be exported as "1.html" and the second as "1_1.html". A third note will be exported as "1_2.html".

For this reason, Tinderbox will not return a value if testing $HTMLExportFileName, except if it has a value set explicitly. Even in the case of the latter, the stored name value will be modified according to the above rules should a naming collision occur.

However, a filename can be derived via $HTMLExportPath, which holds the calculated export folder/filename path for the note (read-only). This uses the as-exported folder and file names from export root that would be created if the file were exported at that time. It thus show the names of the folders & file with any characters omitted or substituted as part of the export process.

This can be extremely useful in more complex export scenarios where there is a need to reference in code an exported note's OS filename or path without being forced to hard-set $HTMLExportFileName. If not set, the latter cannot be queried within Tinderbox.

To get just the exported filename from the path:

$MyString = $HTMLExportPath.split("/").at(-1) 

For this note:

$Path is: "/A Tinderbox Reference File/Export/Export - name collision for created files"

$HTMLExportPath is: "/index/Export/Export_-_name_collision_for_created_files.html"

Note the spaces being lost in the latter. The export version will also show $HTMLExportFileNameSpacer changes, if the latter is set.