Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Purge files

Status
Not open for further replies.

allen06

Technical User
Aug 26, 2004
1
US
I am new to this forum and really appreciate the information here. I am writing a daily com procedure that would purge data files with a particular extension and only keep 30 days. Does anyone know the basic syntax in the purge or delete command that would only keep files less than 30 days.

Thanks in Advance!
 
Here's the basic purge command:
Code:
$ purge/bef=1-aug-2004 ...

VMS has an excellent HELP facility. Use it. Type "help" at your prompt.

Here is the text from the help on "purge/before"
Code:
PURGE

  /BEFORE

        /BEFORE[=time]

     Selects only those files dated prior to the specified time. You
     can specify time as absolute time, as a combination of absolute
     and delta times, or as one of the following keywords: BOOT,
     LOGIN, TODAY (default), TOMORROW, or YESTERDAY. Specify one of
     the following qualifiers with the /BEFORE qualifier to indicate
     the time attribute to be used as the basis for selection:
     /BACKUP, /CREATED (default), /EXPIRED, or /MODIFIED.

     For complete information on specifying time values, refer to the
     OpenVMS User's Manual or the online help topic DCL_Tips (subtopic
     Date_Time).

Ken Robinson
OpenVMS System Manager
 
To save the last thirty days...

$ purge/log/before= -
'f$cvtime("TODAY-30-","ABSOLUTE","DATE")' filename.ext

Don't have the machine in front of me, but it can definitely be done on one line... the above may be "COMPARISON" instead of absolute - I'm sure you can work it out with a little trial and error...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top