• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting file list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting file list


  • Subject: Re: Getting file list
  • From: kai <email@hidden>
  • Date: Tue, 25 Nov 2003 00:58:34 +0000

on Mon, 24 Nov 2003 23:16:10 +0000, "applescript-talk"
<email@hidden> wrote:

> Is there an easy way to get a list of files within a nest of folders,
> maybe 2 or 3 deep?

In the Finder dictionary, under 'Containers and folders/container' you
should find a reference to this:

"entire contents: reference [r/o] -- the entire contents of the container,
including the contents of its children"

So this:

-------------------------

tell application "Finder" to entire contents of (choose folder)

-------------------------

...would return something like:

--> {file "Pict-1" of folder "FMP Pics Folder" of application "Finder", file
"Pict-2" of folder "FMP Pics Folder" of application "Finder", file "Pict-3"
of folder "FMP Pics Folder" of application "Finder"}

Depending on what you intend to do with the list, you may find a list of
aliases more useful. The Finder can help there, too:

-------------------------

set f to choose folder
tell application "Finder" to try
entire contents of f as alias list
on error
entire contents of f as alias as list
end try

-------------------------

--> {alias "Hard Disk:Desktop Folder:FMP Pics Folder:Pict-1", alias "Hard
Disk:Desktop Folder:FMP Pics Folder:Pict-2", alias "Hard Disk:Desktop
Folder:FMP Pics Folder:Pict-3"}

(The try block is normally required, since any attempt to coerce a
single-item list to an alias list usually results in an error - unless
things have changed in Panther.)

---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: AppleScript SOAP request failures
  • Next by Date: Re: [OT] Question to list manager
  • Previous by thread: Getting file list
  • Next by thread: Re: scriptting Illustrator
  • Index(es):
    • Date
    • Thread