Javascript GetParentFolderName method of FileSystemObject (FSO) provides the functionality to get the name of the folder of specified file
Javascript FileSystemObject (FSO) provides the ParentFolder property that can be accessed through the file object or folder object returned by the GetFile or GetFolder method.