Search code examples
dateautomatorfinder

Automator: Change modification date of selected finder items


I want to create an automator service to change the modification date of the selected finder files to the current date. Where do I start?


Solution

  • Create an Automator service :

    Set the popups to "Files or folders" in "Finder"

    Add the "Run Shell Script" action, set the popups to "/bin/bash" and "as arguments".

    Put this script in the action :

    d=$(date  "+%Y%m%d%H%M.%S") ## the formatted current date
    touch -t $d "$@" ## change the file's modification date
    

    Save the workflow, that's all.