AbsoluteFileName

AbsoluteFileName["name"]

gives the full absolute version of the name for a file in your filesystem.

Details

  • AbsoluteFileName goes to your filesystem to check that the file name it returns corresponds to a file that actually exists.
  • AbsoluteFileName["name"] interprets name relative to your current directory.
  • AbsoluteFileName handles directory designations such as . and ...
  • AbsoluteFileName yields an absolute file name, with standard pathname separators appropriate for your operating system.
  • AbsoluteFileName[File["name"]] is also supported.

Examples

open allclose all

Basic Examples  (3)

Find the full path to the current directory:

Reset the current directory to the previous directory:

Find the full path to a directory:

If the file cannot be found, $Failed is returned:

Scope  (1)

Find the full path of the File object:

Possible Issues  (1)

AbsoluteFileName converts the name to an absolute path and verifies that the path exists:

Use ExpandFileName to convert a relative path to an absolute path without checking it exists:

Wolfram Research (2008), AbsoluteFileName, Wolfram Language function, https://reference.wolfram.com/language/ref/AbsoluteFileName.html (updated 2016).

Text

Wolfram Research (2008), AbsoluteFileName, Wolfram Language function, https://reference.wolfram.com/language/ref/AbsoluteFileName.html (updated 2016).

CMS

Wolfram Language. 2008. "AbsoluteFileName." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/AbsoluteFileName.html.

APA

Wolfram Language. (2008). AbsoluteFileName. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AbsoluteFileName.html

BibTeX

@misc{reference.wolfram_2024_absolutefilename, author="Wolfram Research", title="{AbsoluteFileName}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/AbsoluteFileName.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_absolutefilename, organization={Wolfram Research}, title={AbsoluteFileName}, year={2016}, url={https://reference.wolfram.com/language/ref/AbsoluteFileName.html}, note=[Accessed: 22-December-2024 ]}