How do I display only file names rather than the full file path?

Hi,

I’ve developed a composition which sources a folder with a number of movie files in it, then randomly shuffles all the files into a list, which i can then cycle through. I have two windows displaying in my composition. The first one is the video and the second one gives me the video name and a few other bits of information I need.
However I want to only display the name of the file that is playing eg. Movie1.mov instead i get the full file path eg. file:///Users/sean/desktop/research/movies/Movie1.
Can anyone help with a path that will allow me to only read in the file name of the selected item in the folder I have sourced.

Cheers,
Sean

Hi @sean.byrne !

See @jstrecker her answer for the easiest technique.

Another method would be to split the path url by “/” separator, then split it by “.” and choose the first item.

However, when I do that, I get some %XYZ%, some percent character for some long urls … not sure why.
So I’m joining the composition which is a start, needs to be finished though :(

PS : Don’t forget to set your folder path on the List Folder node, nothing won’t happen unless.
2016-07-20 05.54.52.png  

File Name.vuo (3.98 KB)

Get File URL Values splits up a file path into parts, including file name and extension.

Whoops @jstrecker ! I’m very sorry !
How did I never see that node !

My answer should be deleted ! ;)

No problem! It was added fairly recently (1.2.0).

Do you mind if I leave your answer up? I think it’s useful to show the technique of splitting on slashes. While Get File URL Values is probably better if you want the file name without extension, Split Text -> Get Last Item in List is nice if you do want the extension since you don’t have to append it back on.

1 Like

@jstrecker hell yeah ;) will just remove the part that says there is no such node then.

But I’m getting some extra %%% in the filenames when using the split text technique.

If you mean things like “%20” in place of a space in the file name, that’s because the file name is URL-encoded. Characters, like space, that are not valid in URLs are replaced with special symbols. Since Get File URL Values decodes the URL-encoding, it would be a better choice if you have spaces or other special characters in your file names.

1 Like

@jstrecker ah ok ;)

Thanks