This can be done using only native, non-scripting, KM Actions.
This example macro will Trash or Delete ONLY the files in the Target FOLDER selected in Finder.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
MACRO: Delete (Trash) Files Files with Ext in Selected Folder [Example]
--- VER: 1.0 2020-12-05 ---
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Delete (Trash) Files Files with Ext in Selected Folder [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
Example Input
Example Output
ReleaseNotes
Author.@JMichaelTX
PURPOSE:
- Delete (Trash) Files Files with Ext in Selected Folder [Example]
NOTICE: This macro/script is just an Example
- It has had very limited testing.
- You need to test further before using in a production environment.
- It does not have extensive error checking/handling.
- It may not be complete. It is provided as an example to show you one approach to solving a problem.
HOW TO USE:
- Select the FOLDER in the Finder Containing the Files to Delete
- Trigger this macro
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.
.
- Assign a Trigger to this maro.
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro.
. - REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)- Set Action to Take: TRASH or DELETE
TAGS: @Search @Files @Folder @Move @Finder
USER SETTINGS:
- Any Action in magenta color is designed to be changed by end-user
REQUIRES:
- Keyboard Maestro Ver 8.0.3+
- macOS Sierra+
USE AT YOUR OWN RISK
- While I have given this limited testing, and to the best of my knowledge 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.