• 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: Get the "last" folder...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get the "last" folder...


  • Subject: Re: Get the "last" folder...
  • From: Andrew Oliver <email@hidden>
  • Date: Thu, 15 Sep 2005 15:06:33 -0700

Title: Re: Get the "last" folder...
On 9/15/05 10:48 AM, "Stefan Eriksson" <email@hidden> wrote:

what i want is a script that scans thro everything from a topfolder and down the hierarcy and only reports the folders that contains files, not folders...

Try this :

global foldersWithNoFiles

set topFolder to (choose folder)
set foldersWithNoFiles to {}

checkFolder(topFolder)

on checkFolder(theFolder)
    tell application "Finder"
        -- do we have any files?
       if number of files of folder theFolder = 0 then
           -- no, so add this to the list of file-less folders
           copy theFolder to end of foldersWithNoFiles
       end if
       -- now get all sub-folders
       set subfolders to (folders of folder theFolder)
        --iterate through them
       repeat with eachFolder in subfolders
           -- be recursive
           my checkFolder(contents of eachFolder as alias)
        end repeat
   end tell
end
checkFolder
foldersWithNoFiles

Andrew
:)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Get the "last" folder... (From: Stefan Eriksson <email@hidden>)

  • Prev by Date: Re: a numeric bug.
  • Next by Date: AppleScript, Login hook or login item
  • Previous by thread: Get the "last" folder...
  • Next by thread: convert AS syntax to CLI
  • Index(es):
    • Date
    • Thread