Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

DirLength

  • Last UpdatedOct 29, 2026
  • 2 minute read

Returns the size of a specific directory.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

DirLength

File

Synchronous

No

Supported

Supported

Supported

Executed on Server (see Notes below)

Supported

Description

Returns the size of a specific directory.

Syntax

DirLength ( strPath )

strPath

The path of the directory that will be checked.

Note: Follow the conventions of the target platform for the file path and name, and separators. For example, a file path in Windows starts with a drive letter and uses backward slashes as separators (C:\path\to\file), while a file path in Linux starts at the root directory and uses forward slashes as separators (/path/to/file).

Returned value

-2

Directory does not exist.

-1

Invalid parameters

n

Size (in bytes) of the files and sub-folders in the directory

Notes

By default, this function is executed on the project runtime server even when it is called in a screen on a project thin client, which means it only affects directories and files that are located on the server and all paths must be specified in that context. You can change the default behavior to force this function to be executed on the client where it is called, but if you do so, you must keep in mind that the change will affect not just this function but also several other File functions. To change the behavior of these functions, use a text editor to open your project file (<project name>.app) and then edit the following property:

[Options]

ExecuteFileFunctionsOnClient=1

Also, this function is executed synchronously, which means that the project pauses while it waits for the function to return. As such, if the specified directory is unusually large, then the project could be paused for several seconds while size of the directory is calculated.

Examples

Tag Name

Expression

Tag

DirLength("C:\Studio") // Returns the size (in bytes) of all files and sub-folders from C:\Studio.

In This Topic
Related Links