Deletion of Data
DeleteBatches()
This function deletes batches of a certain status, including the associated documents from the administration database.
For other status values, this macro execution always deletes the file attachments as well. This deletion is performed independently of the Backup.DeleteFromStorage property, since this property relates only to the regular backup.
Parameter | Data Type | Description |
|---|---|---|
1 | Text | Processing status of the batches being deleted Default value: Multiple alternative status values can be listed with comma separators in this one parameter. |
2 | Text | Specification of a minimum age of the batch to be deleted (optional) Deletion is then limited to batches that are this age or older. Syntax: see |
3 | Text | Name of the scenario of the batches to be deleted if their selection is to be restricted to a specific scenario (optional) The name refers to the original scenario before a dynamic scenario change (property |
Examples
DeleteBatches(["Finished", "Canceled"], "10d") deletes all batches with the status “Finished” or “Canceled” that are at least 10 days old.
DeleteEmptyFolders()
This function deletes empty folders from the file system. These folders may contain empty subfolders, but no files at any subfolder level.
Parameter | Data Type | Description |
|---|---|---|
1* | Text | Full path of the folders to be deleted The path can contain wildcard characters. Except in the root element (drive or share), the wildcard characters (drive or share), the wildcard characters |
Examples
DeleteEmptyFolders("c:/test/*") deletes all empty folders located directly under c:/test.
DeleteFiles(), DeleteFolders()
These functions delete files or folders from the file system.
Parameter | Data Type | Description |
|---|---|---|
1* | Text | Full path of the files or folders to be deleted Except for the root element (drive or share), the wildcard characters |
2 | Text | Specification of a minimum age of the object to be deleted (optional) Deletion is then limited to objects that have reached at least this age. For files, age refers directly to the date of their creation or the date when they were last modified. For folders, it refers to the most recent date value across all constituent files at any subfolder level. Syntax: see NoticeWe do not recommend deleting folders that are still actively in use (e.g., log subfolders with the current date). To reduce cases of access to the file system, the program will remember the existence of a folder the first time it is accessed, until the next time the program is started. A folder that has been deleted in the meantime will therefore not automatically be created again. |
Examples
Examples where the existence of these files is assumed:
c:\logs\mandant1\2025-01-01\test.logc:\logs\mandant2\2025-01-01\test.log
DeleteFiles("c:/logs/mandant*/????-??-??/*.log") finds both files for deletion.
DeleteFiles("c:/logs/*/*.log") does not find a file because one folder level too few is specified.
DeleteFiles("c:/logs/**/*.log") finds the files because ** includes a variable number of folder levels.
DeleteFiles("c:/logs/*/*/*.log") finds the files because all folder levels are explicitly specified. This variant tends to perform better than the previous variant because the program does not have to search ahead across multiple number of levels.
DeleteDbLogEntries()
This function deletes old entries that have exceeded a minimum age from the database, provided that logging to a database table is active. Moreover, the function can only be used if logging to the internal database is performed (i.e., Logging.Database.Type: "Internal" is set).
Parameter | Data Type | Description |
|---|---|---|
1 | Text | Specification of a minimum age of the entries to be deleted Unlike the other Syntax: see Default value: |
Examples
DeleteDbLogEntries("10d") deletes all log entries that are at least 10 days old.