Skip to content

isfilepathroot

  ISFILEPATHATROOT - determine if a file path is at the root or not

  B = ISFILEPATHROOT(FILEPATH)

  Determines if a FILEPATH is at the root of a drive or not.
  For computers for which ISPC is true, ISFILEPATHROOT is true
  if the FILEPATH begins with either '/' or '$:\'.
  For computers for which ISUNIX is true, ISFILEPATHROOT is true
  if the FILEPATH is '/'.

  Note that the file path does not have to exist to specify a valid
  file path. It is just whether it has the structure of a full file path.

  See also: ISPC, ISUNIX

  Examples:
     % on unix
     isfilepathroot('/Volumes/test/mytestfile.txt') % true
     isfilepathroot('myfile.txt') % false

     % on Windows
     isfilepathroot('C:\myfolder\test') is true
     isfilepathroot('/C/myfolder/test') is true