Re: Looking for empty folders
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