Path.GetFileName(string)
Description

Returns the file name, including the extension if any, of the specified path string.

The return value consists of the characters after the last directory character in path. If the last character of path is a directory separator character, returns an empty string.
//Remember to import IO to make Path work.
import System.IO; 

function Start () { //This will print "foo.extension". Debug.Log(Path.GetFileName("SomeFileAtfoo.extension")); }
using System.IO;
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    void Start() {
        Debug.Log(Path.GetFileName("SomeFileAtfoo.extension"));
    }
}
import System.IO
import UnityEngine
import System.Collections

public class Example(MonoBehaviour):

	def Start() as void:
		Debug.Log(Path.GetFileName('SomeFileAtfoo.extension'))