Skip to content

Modern Fs DirEntry Name

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Filesystem › Filesystem Library › DirEntry.Name

DirEntry.Name

Returns the entry's name, without its folder.

Syntax

DirEntry.Name( )

Notes

  • the leaf

Examples

#import "std/fs"
using fs

dim td as FsResultUStr = CreateTempDir( "fbdoc" )
dim as ustring dir_ = td.Value( )
WriteAllText( PathJoin( dir_, "a.txt" ), "aaa" )
WriteAllText( PathJoin( dir_, "b.txt" ), "bb" )
CreateDir( PathJoin( dir_, "sub" ) )
WriteAllText( PathJoin( dir_, "sub", "c.txt" ), "c" )

'' THE LEAF only -- no directory part
for each r in ReadDir( dir_ )
    if r.IsOk( ) then print r.Value( ).Name( )       '' a.txt / b.txt / sub
next

'' Path( ) is the one that can be opened

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Directories

Clone this wiki locally