Page 1 of 1

custom column script for colored bar based on folder size

Posted: 14 Dec 2021 13:55
by cynflux
Hello,
Is there an update script for the custom column script that creates a colored bar based on folder size?
I am trying an existing script, but the only thing that shows up is >draw.bar 0, DD444, FFAAAA.
Thank you in advance.

Code: Select all

// draws colored bars according to the file size
$size = "<cc_size>";
switch (true){
 case $size == 0:          return ''; // draw nothing
 case $size < 1024:        return '>draw.bar ' . 100 * $size \ 1024 . ', 66CC66, BBEEBB';        //smaller 1 KB
 case $size < 1048576:     return '>draw.bar ' . 100 * $size \ 1048576 . ', FFBB00, FFEE88';     //smaller 1 MB
 case $size < 1073741824:  return '>draw.bar ' . 100 * $size \ 1073741824 . ', DD4444, FFAAAA';  //smaller 1 GB
 default:                  return '>draw.bar ' . 100 * $size \ 1099511627776 . ', DD44AA, FFAADD';  //1 GB or more
}

Re: custom column script for colored bar based on folder size

Posted: 14 Dec 2021 14:00
by highend
So you did not set the "Format:" drop-down to "Icon" in the custom column definition window...

Re: custom column script for colored bar based on folder size

Posted: 15 Dec 2021 05:56
by cynflux
Thanks for the reply.
I did not set the Format.
Once I did, the colored bar showed up.
It is close to what I was wanting.
However, I was looking for the functionality similar to what Folder Size has.
FolderSzie-Pie.png
I was also curious to know if there is a way to change the cube icon to a bar in the Space column.

Thanks in advance.