
Isso parece funcionar. O único problema é que não é recursivo.
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
Responder1
Você pode obter todo o conteúdo com o 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
Se a pasta tiver muitos arquivos, usar find provavelmente será mais rápido:
do shell script "find ~/folder -name \\*.torrent" is not ""
Responder2
Tentar:
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