Excluding dynamic entries from [ find ]

If I want to dump the old firewall rules out before adding a new set I use

/ip firewall filter
remove [ find ]

The trouble is that if there is a fasttrack rule, [ find ] returns the dynamic packet counter entry, and remove fails and the script stops executing the current code block. I’m not sure to specify non-dynamic entries to the find command

My current workaround is like this, but I’d like to know if there’s a way to identify dynamic entries with find as I potentially have this problem in other places as well, such as removing static entries from the routing table

/ip firewall filter
remove [ find action!=passthrough ]
remove [find where !dynamic]

or

remove [find dynamic=no]

Or you can use on-error.
But above solutions are better.

Not sure why you like to remove all firewall rules, can you explain what is the goal with this?