get basename from path

Hi all,
I’ m getting mad trying to figure out how can i get the filename of a file from a specific path.
I can’t use folder dat, i have a specific path of a file and i need to get the basename.
Something like the os module can do in python.
There should be some implementation of that since the folder dat can do that.
But i cant figure out how can i do that with my specific code.

Hey there,

Can you elaborate a little bit more? You say:

Why can’t you use folder? You can select in the name format the option “No extension” to have the basename of a file on the folder you are pointing to.

You also say:

Well, then why not using the os package? Is trivial to point to a path and getting its basename:

import os

# Get basename of a file


And as a small tip, if you want to include that all as a single expression in a parameter:


Nice one Rob, didn’t know that!

Should add import() is a built-in Python function.

Inside TouchDesigner however, you can use the shorter:


mod (or ‘Module On Demand’) searches DAT operators, then if not found, external python modules:

Fantastic! Didn’t know that either. Thanks Rob!