Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Directory

Directory( cDirEsp, [cAtributos], [uParam1], [lConvertCase], [nTypeOrder] ) --> aRet

Lists directory entries in an array.

DirectoryAdvPL
01 · OVERVIEW

Overview

Directory returns name, size, date, time and attributes per entry. Drive notation distinguishes workstation and server in TOTVS examples; SmartClient HTML requires WebAgent according to the page warning. The 10,000-entry limit and :N attribute paging depend on the documented build. The public example lists C:\TEMP; this adaptation only prepares a test-server-directory listing without printing filenames. An empty list does not prove authorization or existence. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

Directory( cDirEsp, [cAtributos], [uParam1], [lConvertCase], [nTypeOrder] ) --> aRet

Parameters

cDirEsp
CharacterRequired

Directory and search mask.

cAtributos
CharacterOptional

Selection attributes; D includes directories.

uParam1
NumericOptional

Compatibility; do not supply.

lConvertCase
LogicalOptional

True uppercases names.

nTypeOrder
NumericOptional

Build-dependent ordering: name, date or size.

Return value

Array of entries with five positions per item.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed352()
    Local bList := {|| Directory("/editorial/*.*", "D")}
    // Pre-existing test directory; callback is not invoked.
Return Nil
Expected result

Action prepared without querying the filesystem. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check path and permissions; compatibility uParam1 should not be supplied.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Directory. TDN. Accessed on 2026-10-26.
  2. EURAI. ADVPL/Funcoes/Arquivos de Disco/Directory.PRW. universo_do_desenvolvedor_site, commit a5c83e9490302bdb4a0fc5a9d92c2d569a60773c. Exemplo analisado. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha