Finder close all windows

How to quickly close all Finder windows on Mac

Have you ever had a ton of Finder windows open and took the time to close each window one-by-one? I think some people get into the habit of doing this simply because Command (⌘)+Q doesn’t work with Finder. You can’t “quit” the Finder app, so that popular shortcut for closing apps won’t work.

That doesn’t necessarily mean you have to be relegated to the tedious effort required to manually close a bunch of Finder windows. Instead of individually closing out of each window that you have open, there’s a simple way to quickly close all open Finder windows.

How to close all Finder windows at once

Step 1: Open Finder.

Step 2: Hold the Option key while clicking the File menu.

Step 3: Click Close All.

This will close all Finder windows in one fell swoop. Actually, the Close All command works with pretty much any app, but it’s especially useful for Finder since you can’t actually quit the Finder like you can with other apps.

If you’d prefer to avoid the menu bar, you can just use this keyboard shortcut instead:

Do you use this shortcut to quickly close out of the Finder windows on your Mac? Share your thoughts down below.

Can you undo close all Finder windows (alt + click the red close button)?

I just inadvertently closed around 20 Finder windows in one click, each related to ongoing projects in them, by clicking the red window button and having «alt» key pressed.

Is there something I can do to reopen all the windows that have just been closed?

It might be too late for me now but if I make this mistake again it will save me a lot of time to reopen these windows.

1 Answer 1

This functionality is not available natively in Finder, but it can be gained by the use of third party software such as XtraFinder and perhaps Default Folder X. Please note though that you would have to check compatibility as you don’t specify what version of macOS you’re using.

Читайте также:  Free vst mac os

Another option that may interest you is to access your recent folders. To do this:

  • Ensure you have Finder active
  • Click on the Go menu
  • Hover over the Recent Folders sub-menu
  • You’ll now see your most recently opened folders
  • Select the folders one by one to reopen them

Notes:

  1. This is not an undo option, but at least you can easily reopen most of your Finder windows (although not likely as many as 20 of them).
  2. I have no affiliation whatsoever with either XtraFinder or Default Folder X.

Question: Q: How to close all Finder windows at once except one?

How to close all Finder windows at once except one?

macOS 10.12.6 (16G29) Sierra.

iMac with Retina 5K display, macOS Sierra (10.12.6), Booting from internal Apple SSD 2TB

Posted on Oct 13, 2017 11:24 AM

All replies

Loading page content

Page content loaded

You can close all Finder Windows clicking the red button with the option key held down.

You can use key shortcuts to open the Finder window you want (see Finder>Go),

and one default preference can be set Finder>Preferences>General (command N)

Oct 13, 2017 11:31 AM

Thanks. But is there a way to close all windows at once except one?

Oct 13, 2017 11:46 AM

This is not possible.

Oct 13, 2017 11:48 AM

Well, it seems that is was possible before:

Close all but current Finder window

Yet, that does not work with Sierra.

Oct 13, 2017 12:26 PM

That article is more than 11 years old when 10.4 Tiger was the newest version. There have been 9 major version upgrades since then. It’s not surprising that those features no longer work.

Oct 13, 2017 2:05 PM

You can still use the AppleScript suggested at the macworld link you posted, but there’s no need for any ‘ third-party keyboard shortcut tool ‘ since automator can create a Service which runs an AppleScript; and System Preferences — Keyboard — Shortcuts — Services allows you to assign a keyboard shortcut to it.

Not perfect, since there’s a noticeable delay when using it; but perhaps it’s quicker for you than closing the others manually.

Oct 13, 2017 2:48 PM

The following AppleScript will get the window id of all Finder windows and process all except the first window. It closes the windows in the opposite order to their creation, leaving the original Finder window displayed. It will also close all collapsed Finder Windows, except the very first that was created.

Читайте также:  Get windows 10 update download

tell application «Finder»

activate

set wlist to index of every Finder window

copy rest of wlist to winlist — items 2 .. n of opened windows

repeat with idx in ( reverse of winlist )

tell Finder window idx to close

end repeat

end tell

return

Oct 13, 2017 8:19 PM

The following AppleScript will get the window id of all Finder windows and process all except the first window. It closes the windows in the opposite order to their creation, leaving the original Finder window displayed. It will also close all collapsed Finder Windows, except the very first that was created.

tell application «Finder»

activate

set wlist to index of every Finder window

copy rest of wlist to winlist — items 2 .. n of opened windows

repeat with idx in ( reverse of winlist )

tell Finder window idx to close

end repeat

end tell

return

This code can be used in an Automator Service, like the following (name of service is arbitrary):

And in System Preferences : Keyboard : Shortcuts : Services : General, I assigned a keyboard shortcut of control+command+W, which allows one to invoke the Finder Window closing code from the keyboard, or one can choose Finder menu : Services : All Finder WIndows But One.

How to close all Finder windows using JXA

I basically want to port this code from AS to JXA:

Thanks in advance! There is so little information about JXA out there!

3 Answers 3

This one-liner will close every Finder window:

You could implement the full script like this:

To close all Finder windows, the script need a loop:

or with the map method:

The following should work:

Alas, JXA is made of Lame and Fail † so just throws an error when you run it, so you’ll have to use a loop to close each window one at a time.

You do need to be careful though when iterating over an array of object specifiers, as only by-ID specifiers are guaranteed to be stable. (Remember: object specifiers are first-class queries, not pointers, so behave very differently to OO-style references.) On this occasion, jackjr’s finder.finderWindows().forEach(function(w) ) will do the job, because finder.finderWindows() returns an array of by-ID specifiers. However, if the array contains by-index specifiers then you must iterate those specifiers from last to first or else you’ll get off-by-N errors.

Читайте также:  Ufo enemy unknown 1994 для windows

† (TBH, for any non-trivial automation work, you’re best sticking to AppleScript. The language itself may be crap, but it’s the only currently supported option that actually speaks Apple events right.)

Finder close all windows

Have you ever wished you could clean up your Finder workspace without closing the frontmost window? I often end up closing much of the clutter manually, but I just discovered a trick that lets me do it fairly easily:

  1. In the window you want to keep, press Command-Shift-G to produce a «Go to Folder» sheet.
  2. Press Command-Option-W to close all windows.

Result: The Go to Folder sheet prevents the window it’s attached to from closing, but all the other close as expected.

[kirkmc adds: Nice hint! However, note that this only works when you close all windows from the keyboard; if you hold down the Option key and click the Close button in any of the Finder windows, this closes the window with the Go to Folder sheet as well.]

  • Currently 3.88 / 5

You rated: 4 / 5 (8 votes cast)

Hint Options

Nice find, but this sounds more like a bug. Don’t count on this one still working in 10.5 🙂

Not a bug. It has a sheet on it, so it doesn’t dismiss. The option close is more likely the the bug.

Been waiting for a hint like this for a long time. Even though it may be a bug it’ll be used heavily until it’s fixed. Thanks for sharing!


Jayson —When Microsoft asks you, «Where do you want to go today?» tell them «Apple.»

Finder Window Manager (recently updated to a Universal Binary) includes this functionality and more. You can close or collapse all windows but the front, stack & tile windows, use Window Sets and much more.

I was wondering, sir, if you might do me a favor. Could you please mention Finder Window Manager in more threads? I’m simply not reading about it enough times with the approximately five quintillion times you currently mention it. Thanks very much!

I checked — and he’s right. Five quintillion is about 4.99 quintillion too many mentions. Besides, it’s one of those tools I’d love to use but it’s got waaay too much going on.

just in case this bug gets fixed here’s a quick applescript to do the same thing. Save it as an app and drag it to you finder tool bar. It will close all but the frontmost finder window.

Оцените статью