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

Edge HMI

DeleteOlderFiles

  • Last UpdatedOct 29, 2026
  • 2 minute read

DeleteOlderFiles is a built-in function that deletes files that are in a specified path, that match a specified mask, and that are older than a specified date and time.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

DeleteOlderFiles

File

Synchronous

No

Supported

Supported

Supported

Executed on Server (see Notes below)

Supported

Syntax

DeleteOlderFiles(strPath,strMask,strDate)

DeleteOlderFiles ( strPath , strMask , strDate )

strPath

The file path or location of the files to be deleted.

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

strMask

A mask or filter, using wildcard characters, that specifies the files to be deleted. For example, "*.hst" means all files with the .hst extension.

strDate

The cut-off date and time. Any files that are older than the specified value will be deleted.

Specifying a time is optional; you can specify a date only.

The specified value needs to use the date/time format of the station on which the function will be executed, which is not necessarily the station on which the function is called. For more information, see Notes below.

The project runtime server on Windows platforms uses the following date/time format by default:

MM/DD/YYYY HH:MM:SS

The project runtime server on Linux platforms uses the following date/time format by default:

DD/MM/YYYY HH:MM:SS

You can customize the date/time format for the project runtime server. For more information, see About the date format and how to change it.

Return value

This function returns the number of files that were deleted.

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

Examples

Delete all .hst files in the project's history folder that are older than 6:00 PM on February 25, 2015:

DeleteOlderFiles("C:\Studio\Project\Hst\","*.hst","02/25/2015 18:00:00")

In This Topic
Related Links