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
2 replies

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.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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.