Simple (?) Disk space report

(imported topic written by dhtorsdc)

The following relevance is simple and outputs drive name, free space in bytes, total space in bytes. (Debugger example)

Q: ((names of it), (free spaces of it), (total spaces of it)) of drives

A: C:, 1088339968, 34357637120

A: D:, 7161155584, 42944151552

T: 0.380 ms

I: plural ( string, integer, integer )

What I really want is something more readable with a % free column. e.g.

C:

1.01

GB

32.00

GB

3.2%

D:

6.67

GB

39.99

GB

16.7%

Try to put some math into the original relevance statement above and you get errors. Any way to get it the way I want it? Easy with single system drive, but seems difficult with > 1 drive. Thanks in advance.

(imported comment written by Lee Wei)

You can give this a try.

The Relevance Language does not handle “%” well because it is an escape sequence.

( item 0 of it,
(it as string & " GB") of (relative significance place 2 of

               (item 1 of it as floating point/(1024*1024*1024) as floating point)),
       (it as string & " GB") of (relative significance place 2 of
                      (item 2 of it as floating point/(1024*1024*1024) as floating point)),
       (it as string & " Percent Free") of relative significance place 2 of
                      (item 1 of it as floating point / item 2 of it as floating point * 100)
   )
   of (names of it, free spaces of it, total spaces of it) of drives

Lee Wei

(imported comment written by dhtorsdc)

Thanks Lee!

I am trying to use this with the > operand
((
(it as floating point ) of relative significance place 2 of
(item 1 of it as floating point / item 2 of it as floating point * 100)
)
of (names of it, free spaces of it, total spaces of it) of drive “C:”) > 10

but it must be singular. Any idea how to make the left operand singular for this use case? I am trying to come up with the percentrage basis of a disk and send an alert using SMTP if the disk is below a certain percentage. Let me know if this is achievable. I appreciate your expertise. I know this is an old thread!

You have taken a single object (drive “C:”) and then asked for plurals of name, free space and total space.

A direct translation of your relevance is

(((it as floating point) of relative significance place 2 of (item 1 of it as floating point / item 2 of it as floating point * 100)) of (name of it, free space of it, total space of it) of drive "C:")> 10

However, you are retrieving more properties than you use and then doing a lot of conversion to floating point and formatting of the result

Depending on how much accuracy you need these are quicker

(((free space of it * 100) / total space of it as floating point) of drive "C:") > "10.0" as floating point

((free space of it * 100) / total space of it) of drive "C:" > 10