Create New FOLDER in Current @Finder Folder

files_folders
finder

#1

Use Case

As some of you may be aware, the Finder already offers a similar feature. While it works OK, this macro offers the following:

  1. A prompt to enter the folder name, which you can cancel.
  2. Tests for a folder already existing by the same name, and gives you an opportunity to cancel or overwrite.
  3. I have a companion macro, that uses the same hotkey trigger, that will create a new blank file in the parent folder.
  4. I am also converting all of my Finder macros/scripts to also with with Path Finder. It will work with whichever is frontmost.

So this macro may, or may not, be a benefit to you over the Finder feature. You can choose.

MACRO:   Create New FOLDER in Current @Finder Folder

~~~ VER: 1.2    2018-03-25 ~~~

DOWNLOAD:

Create New FOLDER in Current @Finder Folder.kmmacros (13 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Create a New Folder in the Current Finder Folder/Window
  • Provides an option to first Trash an existing Folder by the same name.

HOW TO USE:

  1. Open Finder window to the parent folder where you want to create a new sub-folder.
  2. Trigger this macro
  3. Enter Folder Name in KM Prompt

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. :wink:
      .
  • Assign a Trigger to this maro. I prefer ⌘⇧F which will replace/override the Finder shortcut to create new folder.
  • Move this macro to a Macro Group that is only Active when you need this Macro, most likely your “Finder” group.
  • ENABLE this Macro.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    • ALL Actions that are shown in the magenta color

USE AT YOUR OWN RISK

  • While I have given this limited testing, and to the best of my knowledge it will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

image


How to create new folder with a custom name?
#2

Hi @JMichaelTX
I'm wondering if you could help me troubleshoot why my Macro isn't working the way I had hoped.

I used your "Create New FOLDER in Current @Finder Folder" macro as a basis for mine. My functionality needs are simpler and doesn't require user input after triggering the macro.

Here's what I want mine to do:

I have a parent folder full of loose .jpg files and some other .jpg files in sub-folders within that parent folder. I would like to select one or more of them (files and/or folders) then trigger a macro that puts everything I selected into a brand new sub-folder named "Studio" within the existing parent folder. Essentially, I don't what selected files/folders leaving the existing parent folder, I just want them put into a new sub-folder within their current location. I hope that makes sense.

The macro I created using your actions as a reference, works fine when I select one or more .jpg files by themselves or with a sibling folder, however, if I select just an empty folder or a folder with other files inside and run the macro, its name gets CHANGED to "Studio" and a new folder named "Studio" is created inside but all the files that were contained within the folder I selected are now siblings to the folder that was previously their parent. So, I end up with:

ParentFolder > Studio > Studio, image1.jpg, image2.jpg, image3.jpg.
What I want is: ParentFolder > Food > Studio > image1.jpg, image2.jpg, image3.jpg
The original structure was: ParentFolder > Food > image1.jpg, image2.jpg, image3.jpg

I think this behavior has something to do with the 'Move or Rename File' action. It's like, if there are files involved in the selection, it will move them and honor all existing file and folder names, however if there are only folders involved in the selection, regardless of whether they contain additional files, they get renamed instead of being moved into a sub-folder.

Is there a solution to this Move or Rename behavior? I don't want it renaming lone folders I select.

Thanks for your attention.

MikeT

Enclose


#3

If I understand your requirements, workflow, and macro correctly (and that's a BIG IF), then:

  1. You create the "Studio" sub-folder, but you never use it (properly):
    image
    .
    image

The "to" field of the File Actions action must be:

If you wish to just move a file, specify an existing folder as the destination of the move.

by "existing folder" it means the full path to an existing folder.

So, I haven't tested this, but I think you need to change the Move Action to field to:
%Variable%CNF__parentPath%Studio

TEST that (using only test files/folders) and let me know if that works. If not, I'll investigate further.


#4

I'm curious about the Action: Get File Type to Variable CBD__DoesFileExist" - are you using that as a method to check for the existence of the folder?


#5

Hey Evan,

Yes. He is.

Although he uses the action-result instead of the variable in his test.

-Chris


#6

Thanks, Chris. I thought so, but I wasn't sure what the advantage was to doing it that way over checking for the existence of the path using an If statement. Clever idea though.


#7

Hey Evan,

Just another example of TMTOWTDI (There's More Than One Way to Do It).

The IF-THEN action with a path-condition is probably a little bit more readable.

-Chris