0

This seems to work. The only problem is it is not recursive.

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
0

2 Answers 2

1

You can get the entire contents with 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

If the folder has many files, using find is probably faster:

do shell script "find ~/folder -name \\*.torrent" is not ""
1

Try:

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .