FindFile
Details

- FindFile[name] successively searches for a file with the specified name in each of the directories given in $Path.
- FindFile returns full absolute file names.
- FindFile returns $Failed if it cannot find a file with the specified name.
- In FindFile[name], the name can be specified with / path separators (or \\ on Windows). It can also be specified with ` context separators.
- For names of the form "name`", FindFile searches for files "name.mx" and "name.m".
- If FindFile resolves to a directory, it will search for a file named Kernel/init.m or init.m in that directory.
- If FindFile resolves to an object of the form "name.mx" which corresponds to a directory, it will search for a file with a name like name.mx/$SystemID/name.mx.
- Get, Needs, OpenRead, Install and other functions effectively use FindFile to find files to read.
- FindFile[File["file"]] is also supported.
Examples
open all close allBasic Examples (3)
Scope (1)
Find the file specified by the File object:
See Also
FileNames FileNameSetter FileExistsQ SystemDialogInput $Path Get Needs Install NotebookDirectory $Input $InputFileName
Function Repository: ObjectIfExists
Related Guides
Text
Wolfram Research (2008), FindFile, Wolfram Language function, https://reference.wolfram.com/language/ref/FindFile.html (updated 2016).
CMS
Wolfram Language. 2008. "FindFile." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/FindFile.html.
APA
Wolfram Language. (2008). FindFile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindFile.html
BibTeX
@misc{reference.wolfram_2025_findfile, author="Wolfram Research", title="{FindFile}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/FindFile.html}", note=[Accessed: 14-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_findfile, organization={Wolfram Research}, title={FindFile}, year={2016}, url={https://reference.wolfram.com/language/ref/FindFile.html}, note=[Accessed: 14-August-2025]}