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.
Thanks.
iMac with Retina 5K display, macOS Sierra (10.12.6), Booting from internal Apple SSD 2TB
How to close all Finder windows at once except one?
macOS 10.12.6 (16G29) Sierra.
Thanks.
iMac with Retina 5K display, macOS Sierra (10.12.6), Booting from internal Apple SSD 2TB
The whole post...
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.
The whole post...
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.
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)
You can also use Tabs in one Finder window: macOS Sierra: Open folders in new Finder tabs or windows
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.
This is not possible.
Thanks. But is there a way to close all windows at once except one?
Well, it seems that is was possible before:
Close all but current Finder window
https://www.macworld.com/article/1051211/findercloseall.html
Yet, that does not work with Sierra.
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
How to close all Finder windows at once except one?