This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

FileNameTake

FileNameTake["name"]
gives the last path element in the file name "name".
FileNameTake["name", n]
gives the first n path elements in the file name "name".
FileNameTake["name", -n]
gives the last n path elements in the file name "name".
FileNameTake["name", {m, n}]
gives elements m through n in the file name "name".
  • FileNameTake by default assumes that path elements are separated by pathname separators suitable for your operating system.
  • FileNameTake[..., OperatingSystem->"os"] uses the conventions of the specified operating system. Possible choices are "Windows", "MacOSX" and "Unix".
  • FileNameTake just operates on names of files; it does not actually search for the file specified.
  • If more elements are requested than are present, FileNameTake just gives those that are present.
Extract last path element from a file name:
Get different path elements in a file name:
Find out where Mathematica is installed:
New in 7