BASH SCRIPTING RECURSIVE FUNCTION

Viewed 36

? Write a bash shell program to determine the maximum size of all files under a given directory. The directory is given as the command-line argument to the shell program. Note that the directory may contain sub-directories; your program must descend to all subdirectories to determine the maximum size of all files.

The program should be able to:

Handle files that are symbolic links

Handle hidden files (filenames starting with a dot “.”)

If multiple files have the same size, you can choose any of them (to report, if they are of

the maximum size)

Report the file with maximum size using the relative path.

You must write a (recursive) function to implement the functionality to determine the maximum size of all files under a directory without pipelining a number of existing Unix tools.

0 Answers
Related