Originally Posted by
rkmcswain
If you don't mind using a 3rd party tool, then the (dos_chkdsk) function in
DOSLIB does what you want.
It will return 3 values: total disk space, used disk space, and free disk space. DOSLIB has dozens and dozens of other cool functions like this.
If you want to avoid using a 3rd party tool, then you can do it like this:
Code:
(defun foo ( / fso drive fs m)
(vl-load-com)
(setq fso (vlax-create-object "Scripting.FileSystemObject"))
(setq drive (vlax-invoke-method fso 'GetDrive "C"))
(setq fs (vlax-get-property drive 'FreeSpace))
(setq m (vlax-variant-value fs))
(rtos m 2 2)
)
Similar code can be used to find the total size, etc.
Thanks!!
This is what I ended up with:
Code:
(defun foo ( / fso drive fs m)
(vl-load-com)
(setq fso (vlax-create-object "Scripting.FileSystemObject"))
(setq drive (vlax-invoke-method fso 'GetDrive "C"))
(setq fs (vlax-get-property drive 'FreeSpace))
(setq m (vlax-variant-value fs))
(setq GBfree (strcat (rtos(* 0.000000001 m)2 2)" GB free space on C_drive"))
(setq HDFS (strcat "J:\\TEMP\\Drive_Space\\" (getvar "loginname")".txt"))
(setq File#1 (open HDFS "w"))
(write-line GBfree File#1)
(close File#1))
(foo)
Thanks again,
Chris