Version: 2018.1


Switch to Manual


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.

using System.IO;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { Debug.Log(Path.GetFileName("/Some/File/At/foo.extension")); } }