View Full Version : AppleScript: list files in folder

the Otter
Apr 5, 2011, 03:38 PM
Okay, folks. This is an incredibly weird one. I know this has worked before. I stripped the code down to its barest form, so here it is, in its entirety:

tell application "Finder"
set theFolder to choose folder
set fileList to every file in theFolder
end tell

When I run itóregardless of the folder I chooseóI get the following message:

AppleScript Error
Finder got an error: Canít get alias "[path to folder]".

Anyone got any thoughts? Iím banging my head against this one.

Apr 5, 2011, 03:49 PM
What OS version?

Where are you running it from? AppleScript Editor? Something else?

Exactly which folders have you tried it on? Be specific.

What user account are you logged in as?

Break It Down.

If you take out the second line, what is the resulting theFolder value? What is its type? Is it a string, an alias, a fnord, something else?

If you change the variable name from theFolder to myFolder or eineKleineFnordMusik, what happens?