Copy the most recently modified file from one folder/volume to another

Brand spanking new user here. TIA for any and all assists.

I'm interested in a variation on what was mentioned here and here: Let's say I have projectSSD and projectCard. When I plug in projectCard, I'd like to copy the most recently modified file from projectSSD to projectCard.

So far, I have:

  • Trigger = volume with exact name projectCard is mounted.
  • Perhaps an If Then Else to check to make sure projectSSD is mounted?
  • For each path in folder, ... by modification date, reversed...?

From there, it seems like because the Finder sorts contents by modified date, it could be as simple as selecting the first file.... It doesn't seem like I should have to write my own sorting code, but isn't that effectively what's suggested in the referenced post (comparing each file and updating a "latest date" variable accordingly)?

I've looked at the manual and it doesn't seem that "by modification date" would pick the file for me, correct?

It's not the Finder. You already have the answer:

Presuming the file is in the root of the newly mounted volume (which will have a fixed path of /Volumes/VolumeName).

And presuming the file does not already exist at the target destination, otherwise you will have to do additional work with the Copy action to find a new unique name.

A post was split to a new topic: How Do I Copy a File Added to a Folder?