Easy Disk Information

By Foamy on Jan 14, 2006

This will echo to your active window your disk stats;

[Disk Stats (C):(Free: 'Free'GB):(Used: 'Used'GB):(Total: 'Total'GB)]


On your C:\ Drive.

menu channel,query,status {
  DiskStats://echo -a $diskstats
}
alias diskstats { var %d = 0 | var %dd = 64 | while (%d <= 26) { inc %d | inc %dd | if ($disk($chr(%dd)) == $true) { return [Disk Stats ( $+ $chr(%dd) $+ ):(Free: $bytes($disk($chr(%dd)).free).suf $+ ):(Used: $bytes($calc($disk($chr(%dd)).size - $disk($chr(%dd)).free)).suf $+ ):(Total: $bytes($disk($chr(%dd)).size).suf $+ )] } } }

Comments

Sign in to comment.
SypheR   -  Dec 24, 2006

It\'s only for the C drive, many people have more drives like meself. Maybe you should add an option that it searches for other drives and their information aswell. Should be a really good add-on :)

 Respond  
XpLoiTeR   -  Jan 14, 2006

damn this FiverOPtics is amazing ... u have to contact hawkee to be reviewer

 Respond  
FiberOPtics   -  Jan 14, 2006

You can simplify your looping process if you start at var %i = 1 and loop through $disk(%i), since $disk accepts either a name like c: or a number N which represents the N\'th drive. Let me illustrate:

var %i = 1
while (!$disk(%i)) inc %i
; stuff with $disk(%i).[property]

But anyway, once again there is a fundamental design flaw in this, because if you have a floppy inserted in your a: drive, then it will return stats about this floppy drive instead of your c: drive.

Furthermore, as in my case, you may have disk partitions, of which we won\'t get to see any statistics with your code, only of the first partition.

It would be much more convenient, if you made an identifier that takes as parameter the path to the drive, such as c or d, and that your snippet returns the same stats as now, but for the specified drive.

In other words $diskstats() instead of just $diskstats.

 Respond  
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.