FileSystemObject : GetParentFolderName Method


Returns the parent folder name.

Format : 

objectOfFileSystemObject. GetParentFolderName(filepath)

  • objectOfFileSystemObject : As the name says, it’s a FileSystemObject.
  • filepath
    • Mandatory
    • Type:     String
    • File path for which Parent Folder is to be return.

Function FnGetParentFolderName (strSpecificFilePath)

    Set fso = CreateObject("Scripting.FileSystemObject")

    strParentFolderName = fso. GetParentFolderName(strSpecificFilePath)    FnGetParentFolderName = strParentFolderName

End Function

Msgbox  FnGetParentFolderName (“c:\New Folder\file.txt”)


Leave a Comment