[comp.os.vms] Last Access for files

JOHNC%CAD2.DECnet@GE-CRD.ARPA (04/28/87)

> Is there any way to retrieve the last-accessed date for files?

Not directly, but you can come pretty close. 

If you set a retention period for the volume

	set vol/retention=(90-,90-)  $255$dua15

and then mark all the existing files on the volume with an expiration date

	set file/expir=(today+90 days) [000000...]*.*;*

then you can use the expiration date to get last accessed date.  In the
above examples the retention period is set to 90 days.  Any newly created
files will have an expiration date of 90 days after creation.  To start
off with we also mark all current files with the same expire date.

Each subsequent access to any file on that volume will update the expiration
date to date_of_access+retention_period.  Experiment a little to find out
what operations update the expire date (TYPE does but DIR doesn't;  DCL
and FORTRAN opens differ slightly). 

Now, if you want to find files 90 days old it's easy:

	dir/expir/before=today    or    backup/del/expir/before=today

and if you want to find all files over 50 days old:

	dir/exp/before=(today+40 days)

From that base you can make an archival system which cleans up "dead" storage,
however your installation defines it.


								John Child
 	"Keypunch?  What's that?"           	           	General Electric
      "For the times, they are a' changin..."			Aircraft Engines
								Lynn MA