Finding last modified file with relevance code?

Hello,

Is there a way to find the last modified file in a directory via relevance code?

For example it would be something like

find last modified file in /usr/BOSS/bin

can we get more detailed, like the following

find last modified file with file name tbe* in /usr/BOSS/bin

How about something like:

names of files whose (modification time of it = (maximum of modification times of files of folder “/usr/BOSS/bin”)) of folder “/usr/BOSS/bin”

This code works, however the folder i’m using creates 2 files every time a process occurs. It just so happens that the file i need comes right after the file i done need :(.

Is there anyway to give me the last modified file with a name of X?

Something like this.

names of files whose (modification time of it = (maximum of modification times of files of folder “/usr/BOSS/pollecr/sosdata/”) and whose (name of it contains “hme”)) of folder “/usr/BOSS/pollecr/sosdata”

Try this (Modified with the notes from below)!

names of files whose (name of it as lowercase contains "hme" AND modification time of it = (maximum of modification times of files whose (name of it as lowercase contains "hme") of folder "/usr/BOSS/pollecr/sosdata/")) of folders "/usr/BOSS/pollecr/sosdata/"

Essentially we need to put your two conditions in the first whose clause – we can’t just chain whose with an and.

Bill

1 Like

Hey thanks for the quick reply.

Unfortunately this returns an “expression could not be parsed” error

Q: names of files whose (name of it contains “hme” and modification time of it = (maximum of modification times of files whose (name of it contains “hme”) of folder “/usr/BOSS/pollecr/sosdata/”) of folder "/usr/BOSS/pollecr/sosdata/"
E: This expression could not be parsed.

@strawgate’s approach is correct (should include the additional filter in the existing whose clause). Can you try the following?

names of files whose (name of it as lowercase contains “hme” AND modification time of it = (maximum of modification times of files whose (name of it as lowercase contains “hme”) of folder “/usr/BOSS/pollecr/sosdata/”)) of folders “/usr/BOSS/pollecr/sosdata/”

2 Likes

Thats prefect! You rock!