<-- Previous || Up || Next -->

Separate Path And File Function
File Names Class

Public Function SeparatePathAndFile( _
      ByRef rPathName As Variant _
    , ByRef rFileName As Variant _
    , ByVal vPathName As Variant _
    ) As Boolean

Separate a path name like "C:\WINDOWS\USER.EXE" into its Path ("C:\WINDOWS") and Name ("USER.EXE") components.
Remove the last path separator "\" unless it immediately follows the drive separator ":".
Function returns True upon success and False upon failure.

Top20: This function is among our "top-twenty" most useful.
    vPathName              rPathName        rFileName
    ---------------------  ---------------  -------------
    C:\                    C:\
    C:\Temp                C:\              Temp
    C:\Temp\Win.Tmp        C:\Temp          Win.Tmp
    \\SJS4\C\Temp\Win.Tmp  \\SJS4\C\Temp    Win.Tmp
    \\SJS4\Entisoft\Tools  \\SJS4\Entisoft  Tools
       Dim strPath As String
       Dim strFile As String
    for example
       SeparatePathAndFile(strPath, strFile, "\\SJS4\Entisoft\Tools") = True
       strPath = "\\SJS4\Entisoft"
       strFile = "Tools"
See also:
    SeparatePathAndFileSample Subroutine
    SeparateDriveAndPath Function
    SeparatePrefixAndExtension Function
    CombinePathAndFile Function
rPathName: String or Variant that will receive the drive and directory path portions of vPathName.
rFileName: String or Variant that will receive the file name portion of vPathName.
vPathName: The path name that will be separated into its drive/path and file name portions. If vPathName is Null or cannot be fixed-up to a string, this function sets both rPathName and rFileName to an empty string then returns False.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.