Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristoferK/e83f31cdf6f77a7c8599ce926bb19b8d to your computer and use it in GitHub Desktop.
Save ChristoferK/e83f31cdf6f77a7c8599ce926bb19b8d to your computer and use it in GitHub Desktop.
[Get Empty Sub-Folders] Retrieves a list of empty sub-folders in a specified folder #AppleScript #System_Events #Finder #folders #empty #aliases
use application "System Events"
on directories of directory without contents
local contents
tell (a reference to the POSIX path of every folder in ¬
the folder named directory) to if contents then
return it where alias is in the class of aliases
else
return it where true is not in visible of items
-- For COMPLETELY empty folders without invisible files:
-- it where alias is not in the class of aliases
end if
end directories
directories of "~/" without contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment