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


gives the number of path elements in the file name "file".
  • FileNameDepth by default assumes pathname separators and other conventions suitable for your operating system.
  • FileNameDepth[..., OperatingSystem->"os"] uses the conventions of the specified operating system. Possible choices are "Windows", "MacOSX" and "Unix".
  • FileNameDepth just operates on names of files; it does not actually search for the file specified.
Find the number of path elements that make up a file name:
File name depths of some standard directories:
New in 7