• 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: Looking for empty folders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looking for empty folders


  • Subject: Re: Looking for empty folders
  • From: "Mark J. Reed" <email@hidden>
  • Date: Fri, 6 Mar 2009 09:57:51 -0500

2009/3/6 Jakub Formánek <email@hidden>:
> find -d "path" -type d -empty

(The -d doesn't affect anything in this case, btw.)

OK, that will find all empty folders recursively.  My Finder solution
as given will only find immediate subfolders that are empty; it won't
descend into non-empty subfolders looking for empty ones further down.
 Take your pick.

I suspect the find command will be faster than the Finder on large
folders.  If you want the "immediate children only" behavior in shell
form, you can add "-maxdepth 1" to the find command.  And to get the
results in more useful list form, "paragraphs of" will do the trick:

set emptyFolders to paragraphs of (do shell script "find " & quoted
form of POSIX path of myStartFolder & " -type d -empty -maxdepth 1")







You can also do a single-level like this:

find "path" -type d -empty -print -o -prune



>
> Example: find -d ~/Desktop -type d -empty
>
> AppleScript Example: set emptyFolders to do shell script ("find -d
> ~/Desktop/Icons -type d -empty")
>
> -jf _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>



--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Looking for empty folders
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Looking for empty folders (From: Ronald Hofmann <email@hidden>)
 >Re: Looking for empty folders (From: Jakub Formánek <email@hidden>)

  • Prev by Date: Re: Looking for empty folders
  • Next by Date: Re: Looking for empty folders
  • Previous by thread: Re: Looking for empty folders
  • Next by thread: Re: Looking for empty folders
  • Index(es):
    • Date
    • Thread