$fsize (File size identifier)

By mm01 on May 05, 2004

add this to your aliases...
usage: $fsize(filename)
returns:
$fsize(mirc.exe) returns... 1.85mB
$fsize($mircdir $+ logs#channel[nick].log) returns... 21.03kB

NOTE: normally $file(mirc.exe).size would return '1937408'... all this does is convert it to megabytes. if the file is less than 1mb, then it returns the filesize in kilobytes. The result is also rounded to two decimal places.

I couldn't find something like this in the snippets catagory (maybe i didn't look hard enough) so i decided to make one myself.

This is a custom identifier that returns the filesize for a given file.
This can be used for a lot of different addons and scripts. Enjoy.

alias fsize {
  if ($file($$1).size < 1000000) { return $round($calc(($file($$1).size)/1024),2) $+ kB }
  else { return $round($calc(($file($$1).size)/(1024^2)),2) $+ mB }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.