Thursday, January 14, 2010

Write a program to print the free space in a given drive

Dim fso, fspace, filespec
filespec = "D:\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fspace = fso.GetDrive(fso.GetDrivename(filespec))
MyReturn = "Drive Name : " & fspace.volumeName & " Available space is : " & fspace.Availablespace
MsgBox MyReturn

No comments: