While I take your point about a built-in, it would suggest that dealing with filesizes is a "major" part of mIRC, and I don't think that's true.

Anyway, why not convert both values to bytes first, and then compare:

alias getBytes {
var %bytesval = $replace($1,b,,k,* 1024,m,* 1024* 1024,g,* 1024* 1024* 1024)
return $calc(%bytesval)
}

alias sortbySize {
var %sizeA = $getBytes($1), %sizeB = $getBytes($2)
return $iif(%sizeA < %sizeB, -1, $iif(%sizeA > %sizeB, 1,0))
}

This avoids contrary cases, such as sortbySize(1025,1K) = 1 (with yours), implying that 1024 > 1025!

Of course, it also allows you to expand your $getBytes easily to include Terabytes, and anything bigger (when the time comes!).


Sais