The DeleteFiles step allows you to delete specified files. This is particularly useful when archiving images on a drive with limited space (for example, a Matrox smart camera).
To delete a single file, specify its full path in the File List input in the Configuration pane. For information on specifying a file path, see the Specifying a path section in Appendix A: Expression syntax.
To delete multiple files, you must specify the full path of each file in an array of strings. For example, {["C:\\text.txt", "C:\\image.png"]} would delete the text.txt file and the image.png file from the C:\ folder of your runtime platform. You can use the LISTFILES function to quickly produce an array for this purpose.
Consider the following examples using the LISTFILES function:
Files to delete |
Expression |
All files in the C:\Tabula Rasa\ folder. |
{LISTFILES("C:\\Tabula Rasa\\")} |
All PNG files in the TempImages subfolder of the DA Documents folder. |
{LISTFILES(CONCAT(PATH("DA Documents"),"\\TempImages"), "*.PNG")} |
All files older than 24 hours in the SavedImages subfolder of the DA Documents folder. |
{LISTFILES(CONCAT(PATH("DA Documents"),"\\SavedImages"), "*", ExceedingAge, 60*60*24)} |
The oldest files in the SavedImages subfolder of the DA Documents folder, except for 200 Mbytes of the most recent files. |
{LISTFILES(CONCAT(PATH("DA Documents"),"\\SavedImages"), "*", SortByTime | ExceedingCumulativeSize, 200)} |
The result array from the LISTFILES function cannot be used with the DeleteFiles step if you select the Shortnames or Folders options.