Group to Folder
by Ian Kirkland
Of all the actions I've created, this is probably among my most-used and – truth be told – favorites. The action groups selected Finder items into a new folder with the name defined in the action's field.
You're probably wondering, "Why not use the grouping functionality already built into Finder's menu?" Good question! Here's why: If you use a project-based organizational scheme or even a mildly-OCD-driven folder hierarchy, you've likely found yourself repeatedly creating like-named folders and subfolders such as "admin", "images", "css", and "js" – a definite 'no no' if you abide by the DRY (don't repeat yourself) principle. So, while you are certainly entitled to habitually enter the same name into Finder's 'New Folder with Selection...' dialog, you can rest a little easier, knowing this action will afford you faster, more customizable options. Let's have a look at these options:
- You can use any combination of text and/or Keyboard Maestro tokens. Imagine dynamically-named folders with Keyboard Maestro function- and/or datetime-based names; folders employing script-output-driven nomenclature; folders created on the fly using your clipboard, blah blah blah, imagination, imagination. I sure you get the idea.
- A decent amount of intelligence is baked into the action. Here's what that means: If an "[insert name here]" folder already exists, the action will group your selection to that folder. It will never overwrite an existing folder. If items with the same names as any of your selected files exist in the folder, they won't be moved. Simple as that.
- It makes project-based work (or any organized work for that matter) much easier, more automated, and less prone to human error.
Action Preview / Example Usage
**In Use (A) - Select Finder Items**
**In Use (B) - Group the Finder Items to a New or Existing Folder**
**How I Use the Action in my Workflow**
I've found this action particularly advantageous when used in a macro palette (I trigger mine with a quick ^N hotkey) as demonstrated above in the 'How I Use the Action' callout. This is especially true given that my organizational schema almost always involves a set of standard folders that end up being local to a given project. Web developers who've had to create more than a handful of "css" or "js" subfolders will be familiar with this concept.
It's important to note that the central philosophy behind the Group to Folder action is succinctness. I didn't want to have to mess with a ton of dialogs or sub-actions at runtime. If I did, I'd simply use Finder's built-in grouping function. That said, certain usability-flexibility tradeoffs were made. For example, there are instances where, say, a single folder is selected in Finder – a situation wherein you'd have to decide whether to group the selected folder to a new folder or create a new folder inside it. I opted for the simplest, most likely use case...creating a new subfolder. A user prompt could certainly suffice at this point. However, I didn't want to go down that road; at least not right now.
- If you come up with any creative uses for the action, please share them here in the comments
- Please report any bugs at: email@example.com
Download Action: KM-Group_to_Folder.zip (1.57 MB)
To install, drop the .zip file onto Keyboard Maestro and it will install it as a Third Party Plug In action. If, for some reason the install fails, simply unzip and place the resulting folder in the Keyboard Maestro Actions directory in Application Support. You can locate this directory by copying the below path, and – in Finder's menubar – selecting "Go › Go to Folder...". Then paste the path into the text field that pops up:
~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.