Help

Re: Formula to ignore everything LEFT of last "/" in file path and file name

Solved
Jump to Solution
1572 0
cancel
Showing results for 
Search instead for 
Did you mean: 
EastEndTom
6 - Interface Innovator
6 - Interface Innovator

Hi there,

I have a conundrum that I hope someone can please help me with! It’s all about the final “/”

Basically I want to extract the last part of a file path + filename string, to leave only the filename. The path and name can all be different lengths, and have different folder depths. The key is to take everything AFTER the final “/” Examples below…

/Volumes/my_drive/documents/pictures/A001.jpeg
/mnt/usb/pictures/123456.tiff
/Server/over_there/no_really/this_one/what a long path/Big File.mov

would parse…

A001.jpeg
123456.tiff
Big File.mov

Any ideas please, fantastic Airtable community?

Thanks!

1 Solution

Accepted Solutions
Kamille_Parks
16 - Uranus
16 - Uranus

You could do it with REGEX_REPLACE()

REGEX_REPLACE(
   {Field Name}, 
   "^(.+)\\/([^\\/]+)$", 
   "$2"
)

See Solution in Thread

3 Replies 3
Kamille_Parks
16 - Uranus
16 - Uranus

You could do it with REGEX_REPLACE()

REGEX_REPLACE(
   {Field Name}, 
   "^(.+)\\/([^\\/]+)$", 
   "$2"
)

That’s amazing Kamille, thanks so much! Worked a charm, you got the skills! Appreciate it.
Cheers.

Samantha_Levin
5 - Automation Enthusiast
5 - Automation Enthusiast

This is really a helpful solution!

I'm still stuck with another related issue. I need to extract the string from the second-to-last section of a file path, essentially to isolate the parent folder of a file or folder. I've looked into regular expressions and have found them to be a bit daunting, so I can't build upon this solution here. 

Using EastEndTom's sample, I need to extract "pictures"  from /Volumes/my_drive/documents/pictures/A001.jpeg.

Does anyone have any suggestions for me?

Thanks!