Linux/Unix Program 1, Computer Programming, Programming Languages

Assignment Help:
**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;
}
}

Related Discussions:- Linux/Unix Program 1, Computer Programming

Creates an object and prompt the user to enter the name, Design an object d...

Design an object definition named Pet, which should have the following fields: name: The name field holds the name of a Pet type: The type field holds the type of anima

Shell script, append two text files vertically

append two text files vertically

What are relative urls, What are Relative URLS ? When a web browser re...

What are Relative URLS ? When a web browser reads an HTML document, it has a great deal of information about the document. This includes the protocol used to retrieve the docu

.net class libraries in .net, .NET class libraries in .NET Whether you c...

.NET class libraries in .NET Whether you create value in C# or VB.NET, you are getting in touch with techniques in the same .NET category your local library. The same .NET str

Building an e-store website in xhtml, The last exercise of each assignment ...

The last exercise of each assignment will be continuous from assignment to assignment and will have the goal of building an e-store website by the end of the course. For the fir

Explain how web designers can deal with css , Explain, in your own words, ...

Explain, in your own words, how web designers can deal with CSS conflict resolution. What is the order of precedence between the different types of CSS (inline, embedded and extern

Write a program to compute the standard deviation, Write three functions, s...

Write three functions, statistics, average, and sD as follows. The statistics function returns no value and has six parameters: four scores followed by their average and standard d

Help with c assignment, You will design and implement a program that will •...

You will design and implement a program that will • analyse the various characteristics of a maze, represented by a particular coding of its basic con- stituents into numbers store

Object-oriented programming paradigm, Object-oriented programming paradigm ...

Object-oriented programming paradigm Object  Oriented  Programming  is  an  aproach  in  which  a  program  is  viewed  as  a  dynamic  network  of collaborating objects, where

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd