Linux/Unix Program 1, Computer Programming, Programming Languages

**This programming assignment is for use in the LINUX/UNIX environment!!

Introduction:
System administration often requires custom written programs and tools. One problem a system admin faces is deleting oversized files on the system.

Assignment Description:
This assignment is to write a program to find files that exceed a given threshold in size. This tool will allow the system admin to find those files that are dominating the usage of the file system.

Program Requirements:
1) The program will take 2 arguments, an options argument and a size argument.
2) The size argument is a number representing the threshold size. For example, if 10 is entered, it will find all files larger than 10 megabytes.
3) The options are to be as follows:
1. -f (this option will display the file name
2. -s (this option will calculate the summary of all file sizes)
3. -t (this option will display the total summary only.
These arguments may be entered in single option fashion or multiple. Example:

$filesize -sf 10

-This will display all files over 10 megabytes and include a summary of all files sizes.
The output is as follows:

80 /home/smith/Tools/decode.tgz
28 /home/smith/Tools/parse_code.a

**NOTE: that decode.tgz is 80 MB and parse_code.a is 28 MB.

4) The program will take the file list in as a stream from the standard input. The "find" command will be used to create the stream, but no options will be allowed to be used.
The "find" command is used here as a simplifying element of the program.
5) The program will use the "stat" system call to filter out dir/block/link/socket files and only return "regular" files.
6) The program will use the "stat" system call to get the file size.



SAMPLE CODE THAT CAN BE USED (You Don''t HAVE to use this):

For POSIX environment:

struct stat sb;
int result = 1; /* result */
if (msg) msg[0] = ''\0'';
if (stat(FN,&sb) == 0) {
if (S_ISDIR (sb)) result = 0;
else if (S_ISFIFO(sb)) result = 0;
else if (S_ISBLK (sb)) result = 0;
else if (S_ISSOCK(sb)) result = 0;
}
}
Posted Date: 2/2/2012 2:11:48 PM | Location : United States







Related Discussions:- Linux/Unix Program 1, Computer Programming, Assignment Help, Ask Question on Linux/Unix Program 1, Computer Programming, Get Answer, Expert's Help, Linux/Unix Program 1, Computer Programming Discussions

Write discussion on Linux/Unix Program 1, Computer Programming
Your posts are moderated
Related Questions
You are asked to develop a replicator (client) that distributes a large job over a number of computers (a server group) on a single switched LAN (our BU04 lab). In this assignment,

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

* Comments in your code are required * Main Program Operation:  # Your program should first prompt the user for an integer to seed the random number Generator. "Enter an seed

Solve the following initial value problem y (3) - 5y'' - 22y' + 56 y= 0;       y(0) = 1;           y'(0) = -2;         y''(0) = -4 Solution : r 3 - 5r 2 - 22r + 56 = (

Define the Control statements in Computer Programming? The statements are part of the program that performs some action. The compiler will check a program sequentially from the

The last matrix operation which we'll see is matrix multiplication. Now there we will start along with two matrices, A nxp and B pxm . Remember hat A must have similar number of c

I have a linux lab class that consist of 1 lab assignment per week for 5 weeks. It is an online virtual lab and is fairly easy, I just don''t have the time.

1)      Go to Start -> Programs->Accessories->Notepad. 2)      Start with a document type tag & an opening tag. Enter the given line in your doc.

The scenario As an XML expert you are required to model a system for an online furniture shop. After an interview with the shop manager you have the following information: T

What is JVM-Java Virtual Machine  A JVM stands for java virtual machine. This is virtual computer or an abstract computer that runs the complied java programs. In fact JVM is