Add new column with file size

In addition to the other columns, it would be useful to have a column with the file size of the file

Something like

%_file_size% File size in human readable format
%_file_size_bytes% File size in bytes
%_file_size_kb% File size in kilobytes
%_file_size_mb% File size in megabytes

found in:

You know, I must be getting old - I had added some custom/additional columns a long time ago, but I've been so happy with MP3Tag, I haven't felt the need to tweak it for a long time

Thanks for the reminder

Edit:

I'd like to format it to return 1,234.5 MB, but

$fmtnum($num(%_file_size_mb%,1)) MB

drops the .5 part and only displays 1,234 MB

Is there a format that I can use?

simply use %_file_size%, no special formatting.

I'm not sure if there is a formula for MB as you wish.
I have created all 8 possible variants without and with $fmtnum and can't find your 1,234.5 format.
(My windows system is using an apostrophe as thousands separator, not a comma).

From the help:

$fmtNum(x) formats number x with separator for thousands according to current locale settings.

Using very big numbers, $fmtnum seems to "shorten" the values: Please check the line with 11.82GB (shown as 11) and 26.54MB (shown as 26). I can't say why the column with MB doesn't use a thousands separator at all and why the formatted MB doesn't show the numbers after the decimal separator.

I went back to the 'basic' = %_file_size_mb% MB, and then $fmtnum(%_file_size_mb%) MB

The 'basic' displays as 1234.56 MB and the other displays as 1,234 MB

BTW, %file_size% is smart (always 2 decimals though) but it adjusts to GB, MB, KB etc, I would prefer to keep the units consistent just to make it easier to review

I was trying to figure out how to get some of both:

the 1000's separator and only one decimal so that it would display as 1,234.5 MB

I did try (from reading the manual) $fmtnum($num(%_file_size_mb%,1)) MB but the $num() seems to be ignored (I was hoping I could fake it out)

It would seem to me that adding a second parameter to $fmtnum(x, y) where optional y (default = 0) is the number of decimals would be a nice feature to add

Meanwhile, try this:
$fmtNum($div($add($div($mul(%_file_size_bytes%,100),1048576),5),100)).$div($right($add($div($mul(%_file_size_bytes%,100),1048576),5),2),10) MB

Thank you

That really works well

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.