Close All But The Current Finder Window 11

Apple Script

Close All But The Current Finder Window

Hey

If you Finder extensively to move around windows and files you will probably end up with a lot of Finder windows open. I like things neatly organised. The problem with this is that you can end up with a lot of screen clutter. With the help of the Internet I have come up with a quick Applescript that you can use to close every window but the one you are using. Its really simple to make and run.

First open up the Apple script editor in Applications and type or copy and paste the following code:

tell application "Finder"
repeat while window 2 exists
close window 2
end repeat
end tell

Hit the compile button. Then go to File > Save As and set the File Format to Application. At the same time check the Run Only option and uncheck Startup Screen. Save this into a suitable place on your hard drive.

Open up a Finder window and drag your script into the sidebar or any other suitable location.

Then, to test, open up a couple of Finder windows. Hit that button and watch them close. The script will run where it will close every Finder window but the one you are using. Neat.

A quick Applescript tip that has saved me a lot of time. Also you can press Command + Option + W to close every window. You can also use the Command + Option key command while pressing the buttons in the top left of any window.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

11 Responses to “Close All But The Current Finder Window”

  1. 1

    Very nice and clean – using quicksilver to navigate and open apps on my MAC I sometimes find myself opening a new finder window, rather than navigating to already open ones.

    Comment By Chip on August 28th, at 9:16 pm

  2. 2

    A more crash boom bang solution I use is to press Alt and click any close button in any Finder window which will close all Finder windows. Boom, gone. Then I press Command + N which will open a new window. I have set in Finder preferences that my default folder is my work folder.

    So it’s not exactly the same thing as this article describes but another quick way to clean up Finder.

    Comment By Anders on August 28th, at 9:47 pm

  3. 3

    There are a million and ones ways in which to achieve the same thing. Using key shortcuts is just a quick probably.

    Comment By admin on August 28th, at 11:33 pm

  4. 4

    I wrote a little app which could be put in the toolbar of finder a year ago with the same code. If like this with a nice icon you can download

    Comment By Thomas Meyer on August 29th, at 6:54 pm

  5. 5

    That is a nice icon Thomas, a lot better than the Applescript one.

    Comment By admin on August 29th, at 6:57 pm

  6. 6

    This closed applications that I had open. I wasn’t expecting that.

    Comment By Girl Friday on September 4th, at 4:03 am

  7. 7

    Really?! It shouldn’t do that. Are you sure you typed the code correctly?

    Comment By admin on September 4th, at 10:38 am

  8. 8

    Recent Links Tagged With Finder…

    Bookmarked your site as finder at JabberTags!…

    Comment By JabberTags - Find New Sites and Explore the Internet on October 10th, at 7:34 pm

  9. 9

    i did this and put it in the places tab in finder

    Comment By Bobberto on January 10th, at 8:19 pm

  10. 10

    Re your “Close All But The Current Finder Window” tip on 28 Aug 2008, I implemented it and it works beautifully. One thing I notice when multiple Finder windows are open is that they are of different sizes. Is there any way to make them all the same? Thanks

    Comment By George on January 13th, at 2:50 pm

  11. 11

    You could probably do an Applescript which runs through and changes the sizes in much the same way as this script.

    Comment By admin on January 13th, at 4:02 pm

Leave a Reply

You can use: <a href> <h1 - h6> <acronym> <code> <em> <strike> <strong> <i> <b>