Re: Finder - Delete empty folders, recursively
Re: Finder - Delete empty folders, recursively
- Subject: Re: Finder - Delete empty folders, recursively
- From: Paul Kampu <email@hidden>
- Date: Tue, 15 Jun 2004 12:08:13 -0400
On 6/14/04 8:56 PM, "Graff" <email@hidden> wrote:
>
tell application "Finder"
>
set theFolder to (folder of the front window)
>
my ClearEmptyFolder(theFolder)
>
end tell
>
>
on ClearEmptyFolder(whatsPassed)
>
tell application "Finder"
>
set theFolders to folders of whatsPassed
>
repeat with aFolder in theFolders
>
my ClearEmptyFolder(aFolder)
>
end repeat
>
if ((count every item of whatsPassed) = 0) then
>
-- display dialog "deleting " & name of whatsPassed
>
delete whatsPassed
>
end if
>
end tell
>
end ClearEmptyFolder
Ken, this works perfectly. Even on deeply nested folder sets! I'll keep an
eye on any strange behaviour. Thank you, very much!
Ronald, your solution worked most of the time. Don't know why but every so
often an empty folder would be missed. Not a big deal, though, better safe
than sorry. A great big THANK YOU to you as well!
All the best!
--
Paul
http://homepage.mac.com/pkampu/ (*not for the faint of heart*)
"No, TRY not. do or do not. There is no TRY." --Yoda(on error handling)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.