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

FileNameTake

FileNameTake
gives the last path element in the file name .
FileNameTake
gives the first n path elements in the file name .
FileNameTake
gives the last n path elements in the file name .
FileNameTake
gives elements m through n in the file name .
  • FileNameTake by default assumes that path elements are separated by pathname separators suitable for your operating system.
  • 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 the last path element from a file name:
Get different path elements in a file name:
Find out where Mathematica is installed:
On Windows, the share name is treated as a single unit:
Extract the last path element from a file name:
In[1]:=
Click for copyable input
Out[1]=
 
Get different path elements in a file name:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
 
Find out where Mathematica is installed:
In[1]:=
Click for copyable input
Out[1]=
 
On Windows, the share name is treated as a single unit:
In[1]:=
Click for copyable input
Out[1]=
New in 7