Michelle Steiner wrote:
> In article ,
> kelpie.DeleteThis@danu.co.uk (Pat O'Halloran) wrote:
>
> > I would like a script that checks a folder for any empty sub-folders
> > and then moves those sub-folders to the trash. I feel it should be
> > simple but I can't seem to get anything working
>
> This is a matter of recursion.
>
> set topLevel to choose folder
> traverseFolders(topLevel)
> on traverseFolders(inputFolder)
> tell application "Finder"
> set FolderList to folders of inputFolder
> repeat with thisFolder in FolderList
> if items of thisFolder is {} then
> delete thisFolder
> else
> my traverseFolders(thisFolder)
> end if
> end repeat
> end tell
> end traverseFolders
>
> One flaw in this script, though, is that if a folder's contents is only
> one or more empty folders, it will empty that folder, which will then
> become empty, but will not not empty those folders.
>
> -- Michelle
Thank you, I'll try that.
>> Stay informed about: Deleting empty folders