2

I'd like to add a new option to the right click menu in finder that would have the same effect as the command line % touch $(pwd) i.e. this will bring the folder to the top of the list when I have finder windows sorted on Date Modified.

2
  • What has your research shown so far? Where are you stuck?
    – Tetsujin
    Aug 4 '21 at 9:30
  • 1
    I have seen answers elsewhere that suggest use of Automator.app. However, they refer to creating a new plugin or service, but neither option seems available in the version I have. A new Quick Action would seem to be what I need and I can create a one-line Shell Script that does what I want, however I can't see how to pass the path of the object that I'm right clicking on into the script as an argument. Aug 4 '21 at 11:29
2

In Automator, create a new Service/Quick Action adding a Run Shell Script action, with settings for both as shown in the image below.

Save it as, e.g.,: Touch

It will then be available on the Quick Actions menu as well as the Services menu.

Note that you could also create this as an Automator application and add it to the Toolbar in Finder using drag & drop, with down as necessary. However, while not absolutely necessary, I'd first give it a nice icon via its Info sheet before adding it to the Toolbar.

Example shell script code:

for f in "$@"
do
    touch "$f"
done 


enter image description here

5
  • Perfect! Many thanks for your answer. Exactly what I needed. Aug 4 '21 at 12:59
  • @Mike Yearworth, I've done this for as long as I've been using a Mac. It definitely comes in handy. Aug 4 '21 at 13:02
  • Suggestion: add this to the touch : -t 203801010001 to make it show up at the top for the next 17 years or so. Or -t 226201010001 to make it show up at the top for the foreseeable future/thru 2261. (I think I had 2038 because HFS+ could't handle dates past 2038.) Sep 6 '21 at 22:23
  • @Matthew Elvey-RNSTT IVERMECTIN, RE: "Suggestion: add this to the touch : -t 203801010001 to make it show up at the top for the next 17 years or so." -- Why!? There was no mentioned in the OP for touch to use the -t option and the answer was marked as the accepted answer, which means it answered his question satisfactorily. Sep 6 '21 at 22:40
  • @ user: OP @MikeYearworth wants something that "will bring the folder to the top of the list when I have finder windows sorted on Date Modified" this would do so AND cause it to STAY there even as new files were created. Sep 7 '21 at 1:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .