Help with conditional tag > filename

Hey everybody. I don't know if the devs are on the forum, but you are, thank you! I have used Mp3tag for years and I really love it.

Anyway, I'm planning an overhaul of my music library, and I want to reorganize by:

Artist\Album [year]\Tracknum - Title

So I have the following for Tag>Filename, but it's not perfect:

C:\music\\%artist%\\%album% '['$num(%year%,4)']'\[$num(%track%,2) - ]%title%

The problem is, for for the Year field I sometimes have text, like 'Misc' and sometimes it's empty. So how can I use $num(%year%,4) when it's a number, just surround it with '[ ]' when it's text, and leave empty when there isn't any year data at all? I tried using '$if()' but couldn't get the logic right.

So all three of these would be possible:

C:\music\Artist\Album [1999]\01 - Track
C:\music\Artist\Album [Misc]\01 - Track
C:\music\Artist\Album\01 - Track

(And sometimes there's no track numbers, but I think I have that part figured out) I could probably do it with regex, but wanted to know if there is a better way. Can you just do $if(%year%, ..., ...) so IF there is year data, THEN ....

Thanks!

Wouldn't it be much easier to filter for those files that have a decent number in YEAR, rename them and then filter for the files that don't and rename them then instead of fiddling a longish $if() statement?
Perhaps something like:
'['$ifgreater($div(%year%,10),10,$num(%year%,4),%year%)']'

Wow, I can't believe that didn't occur to me. Thanks, I'll give it a try.