This is a very good question, and it is not obvious.
The actionscript delete
command can only delete a single file. If multiple paths were provided, it would not work.
Consider a case where multiple files on the system match the relevance: (which is possible in this case)
Q: tuple string items 0 of concatenations ", " of ("FilePath1";"FilePath2")
A: FilePath1
T: 0.058 ms
I: plural string
It is a best practice in general in relevance to always write it plural as if multiple results are possible, because it results in better relevance that is less likely to fail, but in this case we must force a single answer regardless of how many file paths match the relevance. What tuple string items 0 of concatenations ", " of
does is take an arbitrary number of strings returned as a result of the relevance to the right and it picks the first string every time. This will work as long as the strings do not contain ,
within them. If they did happen to contain that, then there is an alternative method.
Another option is the following:
Q: (preceding text of firsts "-TOKEN-" of it | it) of concatenations "-TOKEN-" of ("FilePath1";"FilePath2")
A: FilePath1
T: 0.069 ms
I: plural string
In a case where multiple files match the relevance, the actionscript would delete the first one, but then it would still be relevant afterwards and you would just have to run it again and again until all matching files are deleted. If the success criteria is set to “original relevance becomes non relevant” or whatever that is called, then it would report failure if multiple files are present, even though it should have succeeded in deleting one of them. To properly handle this case, you actually have to set the number of files to be deleted in a parameter and then have the success criteria be custom relevance in which the number of files remaining is less than the number of files at the start.
Another option is to force a singular result such that it will only attempt to delete the file if there is only a single match, otherwise it will give a relevance substitution error, like this:
delete "{ unique value of pathnames of files "FILE_NAME.zip" of folders "CustomSite_CUSTOM-SITE-NAME" of folders "Sites" of folders of folders of folders "AppData\Local\BigFix\Enterprise Console" of folders of folders "C:\Users" }"
This way we keep the relevance plural until the very end, but then we force a singular result, otherwise we throw an error and do nothing. (intentionally) This is not my preferred method.
In order to delete multiple files in a single action, you have to do something else, like these examples:
These examples are better in some ways, but they are also not cross platform because they use OS specific delete commands, which is a bummer.
Reference: