これは動作するようです。唯一の問題は、再帰的ではないことです。
property Location : alias "Macintosh HD:Location"
tell application "System Events" to files of Location whose name extension = "ext"
if the result = {} then tell application "Example" to quit
答え1
Finder で全内容を取得できます:
set f to POSIX file "/Users/username/folder" as alias
tell application "Finder"
files of entire contents of f where name extension is "torrent"
end tell
フォルダーに多数のファイルがある場合は、find を使用する方がおそらく高速です。
do shell script "find ~/folder -name \\*.torrent" is not ""
答え2
試す:
set downloadsPath to (path to downloads folder)
tell application "System Events" to files of downloadsPath whose name extension = "torrent"
if the result ≠ {} then tell application "Transmission" to activate