I am having trouble with my uni homework , I have been reading through my books but cannot find the information i need.
I dont know the code for obtaining file information
We have to write the program in C running on UNIX machines
Im hoping someone can point me to a relevent web site where i can find information I need OR if anyone else has had to write this program or like it can you please help
The following is the homework description:
Implement a utility called recent that will scan a specified directory tree and list all files that match specified criteria.The program is to be invoked as follows:
recent [ path ] [option... ]
The first argument, path should specify the name of the directory at the root of the tree to be searched.If this argument is omitted, recent should search the tree rooted in the current directory "."
There may be several option arguments,in the following formats
-d List the file if its age in days is less than the
given integer
-s List the file only if its size in bytes is greater than the given integer
-u List the file only if it is owned by a user whose username is "string"
when several option expressions are present only those files that satisfy all specified critera should be listed.Note that the user may specify more than one option of the same kind on the command line;
Files should be listed with pathnames relative to the root directory specified in the command line
If recent is invoked with niether a path nor any options, it should list all of the files in the tree rooted in the current directory, "."
In addition to writting out the file name, if a -d option is given on the command line then the age of the file in days should also be written out; if an -s option - size of file in bytes should be printed and if -u option is given the user name of the owner of the file should also be written out.
I dont know the code for obtaining file information
We have to write the program in C running on UNIX machines
Im hoping someone can point me to a relevent web site where i can find information I need OR if anyone else has had to write this program or like it can you please help
The following is the homework description:
Implement a utility called recent that will scan a specified directory tree and list all files that match specified criteria.The program is to be invoked as follows:
recent [ path ] [option... ]
The first argument, path should specify the name of the directory at the root of the tree to be searched.If this argument is omitted, recent should search the tree rooted in the current directory "."
There may be several option arguments,in the following formats
-d List the file if its age in days is less than the
given integer
-s List the file only if its size in bytes is greater than the given integer
-u List the file only if it is owned by a user whose username is "string"
when several option expressions are present only those files that satisfy all specified critera should be listed.Note that the user may specify more than one option of the same kind on the command line;
Files should be listed with pathnames relative to the root directory specified in the command line
If recent is invoked with niether a path nor any options, it should list all of the files in the tree rooted in the current directory, "."
In addition to writting out the file name, if a -d option is given on the command line then the age of the file in days should also be written out; if an -s option - size of file in bytes should be printed and if -u option is given the user name of the owner of the file should also be written out.