Whose Clause - Multiple

I am hoping to find a graceful way to use the whose clause with multiple parameters.

This works…


tell application "Finder"
	duplicate (every item in folder FolderPath whose name contains "HR") to workingFilesFolderPath
end tell

This does not throw an error but does not seem to work either… I do have files that should meet the following condition.


tell application "Finder"
	duplicate (every item in folder pdfFolderPath whose name contains "W_" & "HR") to workingFilesFolderPath
end tell

I am hoping to avoid a convoluted looping solution if possible.

Any ideas?

I found the answer. Credit to Craig Smith.

http://macscripter.net/viewtopic.php?id=24730

I did have to change the syntax slightly from…


set YOUR_VARIABLE to every WHATEVER YOU WANT of WHATEVER CONTAINS WHAT YOU WANT whose PROPERTY (is, contains, is not, etc.) and PROPERTY (is, contains, is not, etc.) and PROPERTY (is, contains, is not, etc.).

I had to put the property in the parenthesis.

The answer is as follows…


duplicate (every item in folder pdfFolderPath whose (name contains "W_")  and (name contains "HR")) to workingFilesFolderPath

Hope this may help someone else too, and Thanks Craig, if you ever see this!

Hi,

each condition must have its own boolean evaluation


tell application "Finder"
	duplicate (every item in folder pdfFolderPath whose name contains "W_" and name contains "HR") to workingFilesFolderPath
end tell

And, as Stefan shows, only one “whose”. Whose is not part of the conditional so it is not “whose. and whose .”

That makes sense. Thanks for shedding some light on that for me! It is always better to know why something works and not just what code it takes to make something work.

Thanks very much for the insight!