Skip to content

TFolder

Official

A folder.

Import:

import { TFolder } from 'obsidian';

Signature:

export class TFolder extends TAbstractFile

Extends: TAbstractFile

Constructor

new TFolder(vault: Vault, path: string)

Constructor.

To get the constructor instance, use getTFolderConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
childrenTAbstractFile[]The children of the folder.
deletedbooleanWhether the file or folder is being deleted.
(Inherited from TAbstractFile)
namestringThe name of the file.
(Inherited from TAbstractFile)
parentnull | TFolderThe parent folder of the file.
(Inherited from TAbstractFile)
pathstringThe path of the file.
(Inherited from TAbstractFile)
vaultVaultThe vault.
(Inherited from TAbstractFile)

Methods

MethodReturnsDescription
getFileCount()numberGets the count of files in the folder.
getFolderCount()numberGets the count of subfolders in the folder.
getNewPathAfterRename(newName)stringGets the path after renaming the file or folder.
(Inherited from TAbstractFile)
getParentPrefix()stringReturns the prefix of the folder path.

If the folder is in the root '/', it returns an empty string. If the folder is 'a/b/c', it returns 'a/b/'.
isRoot()booleanCheck if the folder is the root folder.
setPath(path)voidSets the path of the file or folder.
(Inherited from TAbstractFile)

Links to this page: