Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

List all files in a folder

This is probably pretty simple but I cant seem to get my head round it. I am trying to use applescript to get a list of all the files in a folder. Can anyone help me here

thanks

Don

Xserve, Powerbook g4, g5, Mac OS X (10.4.6)

Posted on Jun 26, 2006 4:19 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 26, 2006 4:40 AM

If you want a list of plain-text 1 filenames use…
list folder (choose folder)
or
list folder some_alias

If you want a list of Finder references…
tell app "Finder" to get items of (choose folder)
or
tell app "Finder" to get items of some_alias

<hr> 1You could then format these into a plain-text list, if that's what you're after. But remember that the Finder already supports this by copying a selection of files and pasting them to, say, a TextEdit document. Dragging and dropping a selection on a TextEdit document will include the full POSIX-style path for each file.
2 replies
Question marked as Top-ranking reply

Jun 26, 2006 4:40 AM in response to Donald Collier1

If you want a list of plain-text 1 filenames use…
list folder (choose folder)
or
list folder some_alias

If you want a list of Finder references…
tell app "Finder" to get items of (choose folder)
or
tell app "Finder" to get items of some_alias

<hr> 1You could then format these into a plain-text list, if that's what you're after. But remember that the Finder already supports this by copying a selection of files and pasting them to, say, a TextEdit document. Dragging and dropping a selection on a TextEdit document will include the full POSIX-style path for each file.

List all files in a folder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.