Determining disk space on users machine

I would like to know if there is an applet out there or code that can be written to determine the amount of available disk space on a user's machine.

My web site needs to determine this for an installation within our intranet.

I was hoping to write this in ASP or javascript...but I figure that only a Java applet could do this.

Thanks in advance!
brdodgeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sghosh092199Commented:
Hey!

I am afraid, Applet has restrictions in performing any System specific operations on the Client machine. For example, if you perform a function like
System.getProperty("java.vm.name") from Applet, it will throw a SecurityException.

Since, you have to perform installation from a Web page, you don't have control on the client machines. So, we can safely rule out the scope of a policy file which grants the necessary permissions.

You do have the option of 'Signed applets', which are authorized to do certain system specific functions on the client machine.
Ravindra76Commented:
If you signed the applet, you can get it.

Runtime rt = Runtime.getRuntime();
String strDiskSpace = null;
Process p = null;
String strOS = System.getProperty( "os.name" );
try{
if( strOS.equals( "Windows NT" )){
p = rt.exec("cmd.exe /c dir c:\\" );
}else{
// Windows 95 , 98
p = rt.exec("command.com /c dir c:\\" );
}
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());
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brdodgeAuthor Commented:
Great!
I'll give you 500 points if you can write this soon!
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

brdodgeAuthor Commented:
I guess I can only give 300 points...so thats as much as I'll give.
Asta CuTechnical consultant & graphic designCommented:
There is a 300 point limit per question.

Have you been helped so that you may choose the expert's comment as the answer to grade and close or is more needed?

Thanks,
Asta
sudhakar_koundinyaCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[points for ravindra76]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.