Purchase Solution

Unix/Linux Shell Script to Count Number of Modified Files

Not what you're looking for?

Ask Custom Question

File "Ageing" Shell Script

A) Write a shell script that will count the number of files in your account that were last modified 5 or more days ago. When you run the shell script, the results should look something like this:

% ageing
there are 19 filles modified 5 or more days ago.
%

B) Modify your script (or re-write it if you wish) to allows the user to choose what the script should use for the last modified day. Example:

% ageing 15
There are 4 modified files 15 or more days ago.

C) Modify the script to get it to back up to "X" number of days and list the files that were modified for each day. Example:

% ageing -3
Files modified 1 day ago
./a.txt
./b.txt

Files modified 2 days ago
./2days.txt
./dir1/test_file.txt
./dir2/test_file2.txt

Files modified 3 days ago
(none)

Attachments
Purchase this Solution

Solution Summary

This solution will teach you how to write various Bash Shell scripts to check the number of files that have been modified X number of days ago.

Solution Preview

Assuming by modification you mean modification of file data ( that is what a file is mostly modified for; i.e change of its data ) then

A)
This problem is very simple and straightforward. You just have to lookup
man find
to find out about the mtime flag ...

Purchase this Solution


Free BrainMass Quizzes
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.

Basic Networking Questions

This quiz consists of some basic networking questions.

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.

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.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.