0

I found part of this question in 2 other posted questions, but I cant seem to get the last step working which is just "opening" the file:

How do I get files found by command-line 'find' ordered by modification date in OS X?

macOS Terminal find most recent file in directory

The end goal is to find the most recent file open by a specific application (in this case, a ".vesp64" file) and then open it automatically on restart.

I figure the "automatically on restart" thing can be sorted as making the script a login item unless there is a better way to do it.

I've tried running this

find . -type f -name "*.vesp64" -print0 | xargs -0 ls -tl dir | head -n 1

which seems to work to find the file I need, but then how do I open the file it found?

edit : there is no way to recall the last state it was in automatically like other apps, so I need to find a way to do it in terminal. this is the program https://www.vsl.co.at/en/Vienna_Software_Package/Vienna_Ensemble_Pro

1
  • 1
    Will it not just reopen in the same state it was quit, or does it not have a recents menu option?
    – Tetsujin
    Commented Aug 8, 2021 at 15:42

1 Answer 1

0

You should be able to start the application with

ViennaEnsemblePro file.vesp64

I'm not on a mac, and I have not used that application, so you might want to check if that statement is correct. Apparently, on Windows that seems to work like that.

Then, use xargs, just like you did for the ls. Personnally, I would not use ls for this; an alternative would be:

find . -printf "%T@ #-# %p\n" | sort -n | sed 's/.*#-# //' | tail -1 | xargs ViennaEnsemblePro

You must log in to answer this question.

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