CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Get free space info from Win98 in Perl

 



brownjenkin
stranger

May 10, 2001, 7:24 AM

Post #1 of 2 (3080 views)
     Get free space info from Win98 in Perl  

Hello,

I'm new to Perl and need to know how to get Perl to find out how much disk space is left on any given hard disk. I have tried a few things like the following:

print `dir >dir.txt`;
open (DIR, "dir.txt");

This crashed my machine - I'm using Windows 98 SE...The purpose of the above code was to get the second last line returned when dir is invoked in DOS, ie the line that contains the amount of free disk space. Once I have that, I can join/split it into an array and use the number to perform checks, etc. I've also tried the stat command:

@stats = stat "C:/";

But when I print this information to the screen, it gives me the same numbers every time (even after deleting/adding files to C:/) ...in UNIX, you can do a stat -f filename to report stats on the file system that filename resides on - I tried adding the -f to the above code, stat -f "a file on C:/"; but it returns nothing. I've also tried piping a command to DOS which crashes the computer big time - lots of blue screens, then it just kacks out.

I should also mention that I'm using the latest (build 626) version of ActivePerl...

Does anyone have any idea why these commands are crashing my computer? Any ideas on how I can get Perl to find out how much disk space is left on any drive?

I started wrting a script that checks the C: drive on a Win 98 machine for free space - when the free space gets small enough, the script looks for large files, copies them to the D: drive, compares the size of the files copied and then deletes the files on C: ...so I've completed the entire script except for the free space check. Any ideas?

I would appreciate any input.

Thanks,
Peter



Jasmine
Administrator

May 10, 2001, 10:07 AM

Post #2 of 2 (3079 views)
     Re: Get free space info from Win98 in Perl [In reply to]  

Your duplicate message has been replied to at http://forums.perlguru.com/showflat.pl?Board=Forum2&Number=10187



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives