I want to select the newest file in a folder and if there are no files at all I want to select the newest folder instead.
Can this be done by a simple command?
Formally expressed I want to execute these commands but the second should only be performed if the first wasn't successful. Is there any modifier that can be used for this usecase?
I would use a script. Conditional logic is what scripting is for.
You could run one command, then see if anything is selected (remember to call tab.Update() to get a new snapshot of the selection details after the first command) and if nothing is selected then run the second command.
I think you already have the pieces to do all that from the GoUpDeep/GoDownDeep scripts we discussed before.