Operations on File Names

Mathematica provides a convenient collection of platform-independent functions for manipulating names of files and directories. These functions can also be used to assemble and disassemble file-name-like constructs such as URLs.

ReferenceReference

FileNameSplit split a file name into directory and name parts

FileNameJoin assemble a file name from a list of components

FileNameTake, FileNameDrop take, drop elements from a file name

FileBaseName ▪ FileExtension ▪ FileNameDepth ▪ NotebookFileName

ExpandFileName textually expand to absolute file name form

AbsoluteFileName determine the absolute name for a file in your filesystem

Directories »

DirectoryQ test whether a name corresponds to an existing directory

NotebookDirectory ▪ ParentDirectory ▪ DirectoryName ▪ ...

$Path ▪ $RootDirectory ▪ $HomeDirectory ▪ $UserBaseDirectory ▪ ...

FileNames list names of files or directories on your computer system

FileExistsQ test whether a file exists on your computer system

FindFile find a file on $Path, etc.

FileNameSetter interactively browse for a file

New to Mathematica? Find your learning path »
Have a question? Ask support »