• 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: Need to search a folder and sub folders for files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need to search a folder and sub folders for files


  • Subject: Re: Need to search a folder and sub folders for files
  • From: Jolly Roger <email@hidden>
  • Date: Tue, 13 Feb 2001 16:41:19 -0600
  • Replyto: email@hidden

on 2/13/2001 2:50 PM, Bob Bader (email@hidden) wrote:

> Howdy list,
>
>
> I am looking for a script that will search through a folder (and infinite
> levels of sub folders) looking at all the files.

You either need to use a scripting addition, or a recursive handler.

If you want to use a scripting addition, I recommend FindFile
(http://MicrocosmSoftware.com/findfileosax.html).

If you want to use a recursive handler, then the following script may be
helpful to you:

-- begin script
set folderPath to (choose folder with prompt "Choose a folder to list:") as
text

tell FolderLister to Listfolder(folderPath)

script FolderLister
global fileList

on GetFileList(pathToFolder)
set theListRef to a reference to list folder pathToFolder without
invisibles
repeat with nextItem in theListRef
set itemPath to pathToFolder & nextItem
if folder of (info for alias itemPath) then
GetFileList(itemPath & ":")
else
set the fileList to fileList & itemPath
end if
end repeat
end GetFileList

on Listfolder(pathToFolder)
set fileList to {}
GetFileList(pathToFolder)
return fileList
end Listfolder
end script
-- end script

(Watch for line breaks and character conversions performed by the list
server.)

HTH

JR


References: 
 >Need to search a folder and sub folders for files (From: Bob Bader <email@hidden>)

  • Prev by Date: Re: Stoping the script until "Enter" is pressed?
  • Next by Date: Re: Accessing a Record by variable
  • Previous by thread: Need to search a folder and sub folders for files
  • Next by thread: RE: Help needed AS & PhotoScripter.
  • Index(es):
    • Date
    • Thread