Explore BrainMass

Unix/Linux Shell Script to Count Number of Modified Files

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

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

Files modified 2 days ago

Files modified 3 days ago

© BrainMass Inc. brainmass.com October 24, 2018, 5:30 pm ad1c9bdddf


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

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

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.