Re: How to examine folder contents
Re: How to examine folder contents
- Subject: Re: How to examine folder contents
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 04 Jan 2001 14:16:27 -0500
- Organization: [very little]
Stephen Gross wrote:
>
Date: Thu, 04 Jan 2001 10:04:07 -0500
>
From: "Stephen Gross" <email@hidden>
>
Organization: Stuart Country Day School
>
To: email@hidden
>
Subject: How to examine folder contents
>
>
Is there a way to find out the contents of a folder?
>
>
Here's my problem:
>
>
I'm writing an applescript to run on multiple machines. Every machine is guaranteed
>
to have a folder called MASTERFOLDER. In that folder, however, will be one
>
subfolder with a variable name. On some machines it might be called X, on others,
>
Y. No matter what that sub-folder is called, there will be a SPECIALFILE in that
>
subfolder that I want to get at. How can I select scan the contents of
>
MASTERFOLDER, select the correct subfolder, then select SPECIALFILE from within
>
MASTERFOLDER:subfolder?
tell application "Finder" to set fldrList to [optn-L]
folders of folder "Macintosh HD:MASTERFOLDER"
repeat with aFldr in fldrList
tell application "Finder" to set theFldr to (contents of aFldr) as text
if (list folder alias theFldr) contains "SPECIALFILE" then
exit repeat
end if
end repeat
try
tell application "Finder" to open file (theFldr & "SPECIALFILE")
on error errMsg number errNbr
if errNbr = -48 then
display dialog "There was no SPECIALFILE in this " & [optn-L]
"machine's MASTERFOLDER"
else
error errMsg number errNbr
end if
end try