Is there any conditional structure we can use in a button command?

I'm trying to change creation date based on modification date in several files.

I have to set creation date = modification date only if creation is newer because I've found strange things like a file modified before it was even created (issues with copying files, changing metadata, etc.)

I have then to set the creation date based on modification date. For this I need a if-then-else structure.

Pseudo-code on a button will be something like this (if creation date is newer that modification date then set creation = to modify date) otherwise leave as it is.

If META createdate > META modifydate
SetAttr META createdate:modifydate
End If

Thanks in advance!

Scripting is what you want.