Purchase Solution

List files in a directory using a Shell Script

Not what you're looking for?

Ask Custom Question

I'm trying to create a shell script that will list files in a directory. Here are the other requirements:
-The files must be listed in sorted order by the file name.
-By default, the program displays only file names.
-By default, the program lists the files in the current directory.

The program must provide the following command line options to the user:
-d [directory]: The option should allow users to specify a directory or no directory name. If the -d option is provided without specifying a directory name; it should create a list from the current directory. The output shall be displayed using the following column headers:
File Name Size Owner Group

-l: This option instructs the program to display a long listing. The output shall display the following column headers:
File Name Size Owner Group

The user selects no options. List the file names under your current directory (~student user name/itec400/homework). The output shall display the following column header:
File Name

I have attached a full description with this information

Purchase this Solution

Solution Summary

The solution shows how to create a shell script that will list files in a directory. Here are the other requirements:
-The files must be listed in sorted order by the file name.
-By default, the program displays only file names.
-By default, the program lists the files in the current directory.

The program provides the following command line options to the user:
-d [directory]: The option should allow users to specify a directory or no directory name. If the -d option is provided without specifying a directory name; it should create a list from the current directory. The output shall be displayed using the following column headers:
File Name Size Owner Group

-l: This option instructs the program to display a long listing. The output shall display the following column headers:
File Name Size Owner Group

The user selects no options. List the file names under your current directory (~student user name/itec400/homework). The output shall display the following column header:
File Name

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.