DIR$ CLOSE statement

Purpose

Force the release of the operating system FindNext handle.

Syntax

DIR$ CLOSE

Remarks

DIR$ CLOSE will cause the operating system FindNext handle to be closed.  Each time a new DIR$() sequence is initiated within a thread, or DIR$() returns an empty string, PowerBASIC automatically closes the FindNext handle to avoid overuse of system resources.

However, in unusual circumstances (such as a recursive directory scan with delete), it may be necessary to close the FindNext handle sooner, through the use of this explicit statement, so that a directory can be removed.

Restrictions

It is never necessary to execute DIR$ CLOSE to simply avoid a "System Handle Leak".

See also

DIR$