Find last pysical ethernet port

In a script, Without knowing how many Ethernet ports are on a router, how do I identify the last port?

aka RB\2011 has 10 ports, I need to ID ether10, CCR1009 has 8 ports, I need to ID ether8

any ideas?

Edit, this also needs to exclude any sfp ports

Run in console:
:put [:len [/interface find default-name~“ether”]]
Here is supposed that default names of ethernet ports numbered sequantually from 1
To get real name (not default) of last port find interface with default-name equal to etherN, where N got in previous command.