Find the oldest file in a directory and ouput how many days old it is

Hello,
The situation is, I have a list of *.zip files in "D:\sysadmin\Eventlogs"
I want to output how many days old the oldest file is base on today’s date

I am able to get a listing of all zip files in a directory "D:\sysadmin\Eventlogs"
Using the line below successfully:
pathnames of find files “*.zip” of folder “D:\Sysadmin\Eventlogs”

I need some help on getting the date of the oldest file and outputting how many days old it is based on today’s date.

Here is an example:

maximum of (now - creation time of it) of files whose (name of it contains ".zip") of folder "D:\Sysadmin\Eventlogs"
3 Likes

@Berjaya has the right idea, but if you want to not just know how old the oldest file is, but you also want to be able to query other info about that file, you have to use single recursion.

(pathname of it, creation time of it, now - creation time of it) of files whose (name of it contains ".zip" AND creation time of it = minimum of creation times of files whose(name of it contains ".zip") of folders "D:\Sysadmin\Eventlogs") of folders "D:\Sysadmin\Eventlogs"
2 Likes

Thanks for your input Berjaya & Jgstew… this worked for me