Trash Files PRIOR to Date Specified @Example

###MACRO:   @Files Trash Files PRIOR to Date Specified @Example

~~~ VER: 1.0    2017-08-12 ~~~

####DOWNLOAD:
@Files Trash Files PRIOR to Date Specified @Example.kmmacros (21 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


###Use Case

  • Move to Trash Files with a Date (Created or Modified) PRIOR to a specified date.

###You May Also Be Interested In
the companion macro
MACRO: @Files Move Files Based on Creation Date


###Example Output

####Finder PRIOR to Trigger of Macro

####Prompt to Select/Confirm Date to Use

Display Files to be Trashed

Confirm Move to Trash

Finder AFTER Completion of Macro

###ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • TRASH Files Based on Creation or Modification Date

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:

  1. In the Finder, select the file with the NEWEST Date that you want to move.
  • The Source Folder, and Dates will be determined from this selection
  • The Dates are set to the next day at 00:00 hours.
  • So the Files to be trashed will be PRIOR to that date.
  1. Trigger this Macro
  2. Confirm the Date to use
  • Clear the Date for the Date you do NOT want to use
  • Click OK
  1. The Macro will display the list of files to be Trashed, and ask you to confirm/continue.
  2. If you continue, the files are trashed.

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.
  • Move this macro to a Macro Group that is only Active when you need this Macro. This is probably the Finder Group.
  • ENABLE this Macro.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)

TAGS: @Search @Files @Folder @Trash @ShellScript @Bash @Find

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

REQUIRES:

  1. Keyboard Maestro Ver 7.3+ (don't even ask me about KM 6 support).
  2. El Capitan 10.11.6+
  • It make work with Yosemite, but I make no guarantees.

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.

Very nice - macro works perfectly, such great documentation too, that’s what really makes the difference for me. I’m able to look at the macros you make, learn so much to then be able to grow and apply them to macros I create. just awesome. - Have a Blessed Sunday

1 Like

@troy, thanks for the feedback. I really appreciate it.

I do try to make my example macros easy to read and understand, so it is good to know that my approach is working. Please feel free to offer any constructive criticism that would improve the macros as a learning tool.

Also, if you come up with variations of my macros, please feel free to post. It is likely that if you needed the variation, others might also. I welcome all improvements/options.

1 Like