?
Solved

How Do I Get HARD DISK FREE SPACE?

Posted on 1998-02-05
3
Medium Priority
?
202 Views
Last Modified: 2006-11-17
How do I get Perl to report the remaining disk space on my web site.  I want my perl script to email me back this free disk space.  Also what about free memory?

I know in C I used special commands for getting free disk space and free amount of memory (free()).

Thanks.
0
Comment
Question by:mirror
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:icd
ID: 1209720
Need to know what operating system your web site is running on. Unix or NT for example?

0
 

Accepted Solution

by:
grsshpper earned 100 total points
ID: 1209721
I am making the assumption that you are using a Unix system of
dsome sort. but even if that is wrong, the following program should give you enough of an idea so that you can substitute where necessary.

You can execute system commands in Perl with the command
system("command");

so system("cp abc def");
will copy file abc to file def in Unix

anyway here's how it works ....

#!/usr/bin/perl

# nb you may have a different location for your perl interpreter
# set line 1 to point to wherever it is.

# execute standard Unix command "df" to report disk space and
# usage and redirect output to the file called space.out
# alternatively if you have compiled C program that reports
# on disk statistics then you could call that and redirect
# its output to the file space.out

system("df > space.out");

#at this point you should call a script to email you the
#contents of space.out


0
 

Expert Comment

by:ljaques
ID: 1209722
Operating systemn is for both NT and Unix.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question