Jump to content

Unfold or fold all folders and subfolders in directory

Recommended Posts


I am completely illiterate in Alfred that I discover and it seems awsome to me! Would anyone be compassionate enough to help me start a workflow that would unfold all folders in a directory ?

Any help would be much appreciated (including of course, learning material to be followed to progress by myself).

Thanks in advance.



Edited by jmm28260
Link to comment

What do you mean "unfold all folders in a directory"? In Finder using List View?


If that is what you mean, OPT+Click on the triangle does that.


Alternatively, you can select one or more folders and use CMD+OPT+Right Arrow to expand all folders recursively. CMD+OPT+Left Arrow collapses them again.

Edited by deanishe
Link to comment

Thank you deanishe for your answer.

My purpose would be to expand (not open) ALL folders and subfolders in the directory, and subsequently, to reduce all of them. Am I clear in my explanation ?

I know that I could click on the triangle, but I would like  a workflow to take care of the procedure for all the folders and subolders.

Link to comment

You are perfectly right, thank you. The point is that I would like it to be included in a wider procedure and therefore be done automatically without my intervention. I wanted it to be automated via Alfred, Automator or Applescript. Does it make any sense to you or am I confusing in my description ?

Thank you for your time. I appreciate.

Link to comment

Okay then. The best way to do this is probably to simulate the CMD+OPT+Right Arrow keypress with AppleScript, like this: 
tell application "System Events" to key code 124 using {command down, option down}
In an Alfred workflow, put that in a Run Script Action with Language = /usr/bin/osascript (AS).

It's up to you to ensure that Finder is the active application and the correct folder is selected, however. If you want to automate that, too, this will show your home folder in Finder in List View:
property theTarget : get path to home folder
tell application "Finder"
    tell front Finder window
        set current view to list view
        reveal theTarget
    end tell
end tell

Can't say much more than that without more details of precisely what you want to do (open the same folder every time, choose the folder to open in Alfred etc.)

Edited by deanishe
Fix AS formatting
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...