I need to loop through a whole lot od d/b records and check if a file (path) is valid and flag if not. I’ve got 2 working methods…
1 Finder
--snippet
if not my TestPreviewPath(preview_path) then
tell record id aRecord
set value of field "Keywords" to "MISSING_PREVIEW"
end tell
end if
on TestPreviewPath(thePath)
tell application "Finder"
if (thePath exists) then
set the theCheck to true
else
set theCheck to false
end if
return theCheck
end tell
end TestPreviewPath
- shell
-- snippet
if my TestPOSIXPreviewPath(preview_path) = "false" then
tell record id aRecord
set value of field "Keywords" to "MISSING_PREVIEW"
end tell
end if
on TestPOSIXPreviewPath(thePath)
set theReply to (do shell script "[ -e '" & thePath & "' ] && echo true || echo false ")
return theReply
end TestPOSIXPreviewPath
I’m assuming the shell is likely faster, or doesn’t it make a difference. Might I do this more efficiently?
TIA