I got it
Here is the code,
import java.io.*;
import java.util.*;
public class GetDiscSpace
{
public static void main( String[] str )
{
Runtime rt = Runtime.getRuntime();
String strDiskSpace = null;
Process p = null;
String strOS = System.getProperty( "os.name" );
try
{
if( strOS.equals( "Windows 2000" ))
{
p = rt.exec("cmd.exe /c dir d:\\" );
}
else
{
// Windows xp
p = rt.exec("cmd.exe /c dir d:\\" );
}
InputStream inStream = p.getInputStream();
BufferedReader reader = new BufferedReader( new
InputStreamReader( inStream));
String strTemp;
while( (strTemp = reader.readLine()) != null )
{
strDiskSpace = strTemp;
}
System.out.println( strDiskSpace.trim() );
StringTokenizer sToken = new StringTokenizer(
strDiskSpace.trim() , " " );
if( sToken.hasMoreTokens())
{
System.out.println( "Free Space : " +
sToken.nextToken() );
}
p.destroy();
}
catch( Exception e )
{
System.out.println( e.getMessage());
}
}
}