Skip to content

Modern Fs DirEntry MoveNext

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

Home › Filesystem › Filesystem Library › DirIterator.MoveNext

DirIterator.MoveNext

Moves the iterator on to the next entry.

Syntax

DirIterator.MoveNext( )

Notes

  • advance

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" )

dim it as DirIterator = ReadDir( dir_ ).GetIterator( )

dim as int32 n = 0
while it.IsValid( )
    n += 1
    it.MoveNext( )           '' advance; it returns nothing
wend
print n                      '' 3

'' The order is always IsValid -> Value -> MoveNext. Reading an entry
'' does not advance, so Value( ) can be called twice.

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Directories

Clone this wiki locally