This chapter would be incomplete without a recipe on working with file lists. We have already seen some of the concepts in our previous recipes. However, for the sake of completeness, we will write a script that lists out files of type .mp4 within our random directory that are more than seven days old and larger than 100 KB. Also, list out the five largest files in the lot.
Listing files and directories
How to do it...
Let's pick the location as $HOME/random. We don't know under what directory these .mp4 files would be. Therefore, do the following:
- Perform a recursive listing of files
- Add a parameter, Name, that lists out only the .mp4 files
- Use the CreationTime property of the file to determine the age
- Perform...