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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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



May 10, 2001, 7:24 AM

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


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:/) 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: I've completed the entire script except for the free space check. Any ideas?

I would appreciate any input.



May 10, 2001, 10:07 AM

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

Your duplicate message has been replied to at


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

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