30

I browse to a folder, then expand through a directory tree to find the file I'm looking for. Now I want to create a folder at the current location within that tree.

  1. "New Folder" from the menu creates the menu in the top-level directory instead of the current directory.
  2. Right-clicking doesn't give any way to create a folder "in-place" - ie with reference to the file or directory I currently have clicked/highlighted.

Simplified example (thanks soulshined):

/Users/user/Downloads/
/Users/user/Downloads/Pictures
/Users/user/Downloads/Pictures/pic1.jpg
/Users/user/Downloads/Pictures/pic2.jpg
/Users/user/Downloads/Pictures/pic3.jpg
/Users/user/Downloads/Pictures/pic4.jpg
/Users/user/Downloads/Pictures/pic5.jpg

The finder window is opened on the /Users/user/Downloads directory, but I have used the tree-expanders to be looking at the files in .../Downloads/Pictures.

I want to add a folder under Pictures, but irrespective of how I invoke it, the new directory will always be created under Downloads.

(Obviously in this example it would be trivial to move it, but imagine the folder is a byzantine corporate shared directory tree,...)

3
  • This question is confusing me because I can do this without any problems. Can you elaborate a little bit more so I can make sure we're talking about the same thing? Say your in 'Downloads' and Downloads has 4 different folders, you click on one of them [Pictures] and it has a list of pictures and you want to add a Folder to Pictures, say to name [2015] or add a folder to Downloads while viewing the contents of Pictures?
    – soulshined
    Commented Jan 30, 2015 at 0:06
  • I’m assuming the OP means in list view. I’ll change the title. Commented Dec 13, 2020 at 12:22
  • And woe betide you try to drag the folder into the correct location. Scroll up/down by dragging is horrendous! Commented Nov 16, 2022 at 10:40

7 Answers 7

16

I think the key bit here is: You have first to double-click the directory within which you want to create the new folder.

Selecting File->New Folder (or Shift-Command-N) won't create a new folder in the current folder (or at least what I would consider to be the current folder)

For example, in the image attached, I would expect "New Folder" to create a new folder inside folder1 (selected) - instead, it will create it in the "Guest" folder - which was the originally opened folder.

To create it in folder1, you first need to first double click folder1.

enter image description here

2
  • 9
    Wow. Thanks! This has to win the Apple's Least Intuitive Feature award.
    – frozenjim
    Commented Dec 29, 2019 at 15:10
  • 1
    I dunno, there are a few other too :) Commented Feb 16, 2022 at 23:36
11

Open the folder that you want to create a new folder in, then File > New Folder or Shift-Command-N.

OR

You have first to double-click the directory within which you want to create the new folder. Once you are inside, right-click and select "new directory".

3
6

This is how I create new folder in the Finder (list view) with keyboard only:

  1. (up/down arrows) - Highlight the folder
  2. CommandO - Open the folder on the same tab
  3. CommandShiftN - create new folder
  4. type the name of the folder Enter
  5. CommandOption8 - go back to the previous folder (same as back button click) Info: The 5. step is same as Command[ shortcut, but I use hungarian keyboard and for the [ character I have to hit the Option8 combo.

On windows + total commander I only had to press F7 button to create new folder :)

1
  • This is pretty good... except "back" doesn't put focus back to where you were. So if you were in a long list, you have to scroll/arrow to find your place again. Commented Nov 16, 2022 at 10:20
4

There's no built-in way to do that in Finder (as of macOS 12 Monterey, 2021), but you can create a custom Automator action instead. This will provide a right click menu item, as well as a keyboard shortcut, to create a folder under the selected folder in Finder. (This answer builds upon the excellent answer by Benwiggy by adding a dialog prompt, keyboard shortcut, and expanding/selecting the new folder.)

Step 1: Create the Automator, Quick Action

enter image description here

  1. Start Automator and click File > New

  2. Choose Quick Action

  3. On the right side, select "Workflow receives current: folders in Finder.app"

  4. On the left panel, select Library > Utilities > Run Applescript. Drag Run Applescript to the right panel.

  5. Copy and paste the below code:

on run {input, parameters}
    
    set SELECTED_FOLDER to (input as text)
    
    # prompt for new folder name
    set NEW_FOLDER_NAME to text returned of (display dialog "Name of new folder?" buttons {"Cancel", "OK"} default button "OK" default answer "")
    delay 0.1 # prevent UI race conditions
    
    # create new folder 
    tell application "Finder"
        set NEW_FOLDER to make new folder at SELECTED_FOLDER with properties {name:NEW_FOLDER_NAME}
    end tell
    
    # expand new folder 
    tell application "Finder"
        set selection to SELECTED_FOLDER
        activate # need to activate before sending keystroke
    end tell
    tell application "System Events"
        # requires System Preferences > Security & Privacy > Privacy > Accessibility: add Finder.app
        key code 124 # right arrow to expand folder
        delay 0.1 # prevent UI race conditions
    end tell
    
    # select new folder
    tell application "Finder"
        set selection to NEW_FOLDER
    end tell
    
    return input
end run
  1. Click the "Hammer" button to compile and get syntax highlighting.

  2. File > Save. Name the script create new folder here.workflow or whatever you want.

Step 2: Create a keyboard shortcut

Now add a Keyboard Shortcut for the Quick Action you just created:

enter image description here

  1. Open Preferences > Keyboard > Services > Files and Folders

  2. You should see the create new folder here item listed.

  3. Click Add Shortcut and assign the keyboard shortcut cmd+shift+M or whatever you want.

    • Note: I originally wanted to assign cmd+shift+opt+N since that was simply opt plus cmd+shift+N, the built-in keyboard shortcut for Finder's New Folder. But that shortcut didn't work for some reason, it just beeped. So I chose cmd+shift+M since it was next to cmd+shift+N.

Step 3: Grant permission to send keystroke to Finder

This is necessary because expanding the Finder folder requires sending the right arrow keystroke, which requires additional permissions.

enter image description here

  1. Open System Preferences > Security & Privacy > Privacy > Accessibility

  2. Add "Finder.app" (/System/Library/CoreServices/Finder.app)

  3. Make sure Finder.app is checked.

1
  • 1
    Working very nicely on macOS 13 (Ventura) too. Shortcuts are now in System Settings > Keyboard > Keyboard Shortcuts > Services > Files and Folders, and there's no "Add Shortcut" bottom (just double-click "none"). Permissions are in System Settings > Privacy & Security > Accessibility although I still got prompted to grant permissions on the first execution anyway. And finally, I also just get a beep on execution if I try cmd+shift+opt+N, and if you set something that's already assigned the existing action happens instead, so cmd+shift+M is a good choice. Commented Nov 16, 2022 at 10:38
2

As of OSX Catalina,

CommandShiftN Creates a new folder within the folder within the open window (in your example, the ~/Downloads directory). File > New folder, the context menu, and the Actions (gear) menu have the same behavior, regardless of what is selected.

This is inconsistent with pre-Catalina in my experience. I don't know why this changed. The only method is to double-click the Pictures directory first.

2

The problem is that List View displays the contents of several folders at once, but it is only 'in' the top level folder that is listed in the Titlebar. The New Folder command behaves the same as in other views, for the sake of consistency. (That's Apple's take on it, whether you agree or not.)

Fo those who want it, I've create a very simple Automator Quick Action that seems to work when you right click on a folder in List View.

enter image description here

on run {input, parameters}
    
    tell application "Finder"
        
        set thefolder to (input as text)
        
        make new folder at thefolder with properties {name:"New Folder"}
    end tell
    
    return input
end run
1
0

Here’s a script you can use for this. It works both in list and column views. The renaming part doesn’t work properly in icon and gallery views, which can be annoying.

To use it with a shortcurt, I exported it as an application from Script Editor and set a shortcut to that application in Butler. I used the standard Finder shortcut for “New folder”, since I don’t need icon and gallery views, but you may prefer something different to still be able to use the regular shortcut. Note that the app must be granted accessibility permissions (System Preferences › Security › Confidentiality).

You may want to adjust the delays to your system’s reactivity, as they can be annoying if you’re used to type the new folder’s name quickly after it’s created. Hoewever, if they’re too low, renaming won’t work.

-- By Philippe-André Lorin
-- 2020-12-13
-- macOS 10.14.4
-- See https://apple.stackexchange.com/a/408759/185198

-- Create folder inside currently selected folder
-- or at the same level as currently selected file

try
    tell application "Finder"
        set selectedItems to selection
        set currentPath to ((the first item of the selectedItems) as alias)
        
        -- Set parent path for future new folder
        if (currentPath as string) ends with ":" then
            -- It’s a folder
            set the parentPath to currentPath
        else
            -- It’s a file
            set {savedDelimiters, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
            set the parentPath to (text items 1 thru -2 of (currentPath as string)) as string
            set AppleScript's text item delimiters to savedDelimiters
        end if
        
        -- Create new folder
        my createFolder(parentPath)
    end tell
    
on error -- No folder or file is selected
    tell application "Finder"
        set the currentPath to (folder of the front window as alias)
        my createFolder(currentPath)
    end tell
end try


on createFolder(folderLocation)
    tell application "Finder"
        -- Make new folder
        set thisFolder to make new folder at folderLocation
        delay 0.2 -- N.B. Without delays, the following operations sometimes fail.
        
        -- Select new folder
        set selection to thisFolder
        delay 0.2
        
        -- Call “Rename” menu in Finder
        activate
        tell application "System Events"
            tell application "System Events"
                tell process "Finder"
                    tell menu bar 1
                        -- N.B. The following must be adjusted to the Finder’s language settings
                        tell menu bar item "File"
                            tell menu "File"
                                click menu item "Rename"
                            end tell
                        end tell
                    end tell
                end tell
            end tell
        end tell
        
        -- Return
        return thisFolder
    end tell
end createFolder

Note. This script was adapted from the first script on this page: http://hints.macworld.com/article.php?story=20081119025327978

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .