$! ********************************************************************** $! * FIND_HIGH_VERSIONS.COM * $! * Searches all mounted disks for files with version numbers * $! * greater than 30000. If any are found, they are PURGEd to one * $! * version, and the remaining file is renamed to version 1. A * $! * report of files purged and renamed is sent to SYSTEM. * $! * * $! * If P1 is specified as "SCAN", the files are not touched -- the * $! * report is still sent to SYSTEM. * $! * * $! * This software has been released into public domain. This * $! * software may be freely copied, distributed, and modified so * $! * long as it contains this message. This software is provided * $! * as is, free of charge. The author assumes no responsibility * $! * or liability for the use of this software. * $! * * $! * Richware http://richj.home.mindspring.com/Richware * $! * * $! * 11-MAR-1997 RDJ Command Procedure Creation. * $! ********************************************************************** $! $ P1 = F$Edit(P1,"Trim,UpCase") $ Close/NoLog Report_File $ Open/Write/Share Report_File SYS_REPORTS:FIND_HIGH_VERSIONS.RPT $ Write Report_File "FIND_HIGH_VERSIONS run on ",F$Extract(0,17,F$Time()) $ If P1 .EQS. "SCAN" Then - Write Report_File "Note: running in SCAN mode only; no actions will be taken." $ Write Report_File "" $ Write Report_File "" $! $ Get_Next_Disk: $ Disk_Name = F$Device("*","Disk") $ If Disk_Name .EQS. "" Then - Goto No_More_Disks $ If F$GetDvi(Disk_Name,"Shdw_Member") Then Goto Get_Next_Disk $ If .NOT. F$GetDvi(Disk_Name,"Mnt") Then Goto Get_Next_Disk $ Call Scan_Disk 'Disk_Name' 'P1' $ Goto Get_Next_Disk $! $ No_More_Disks: $ System_Name = F$TrnLnm("SYS$CLUSTER_NODE") - "::" $ If System_Name .EQS. "" Then - System_Name = F$GetSyi("NodeName") $ Write Report_File "" $ Write Report_File "" $ Write Report_File "A copy of this report has been saved as ", - System_Name,"::SYS_REPORTS:FIND_HIGH_VERSIONS.RPT" $ Close Report_File $ Mail/NoSelf/Subject="''NodeName' FIND_HIGH_VERSIONS Report" - SYS_REPORTS:FIND_HIGH_VERSIONS.RPT SYSTEM $ Deassign/System VERSION_DISK $ Exit $! $! $! ********************************************************************** $! * Scan_Disk: Scan an individual disk for files with high version. * $! * P1 = name of disk to scan. * $! * P2 = SCAN option. * $! ********************************************************************** $ Scan_Disk: SubRoutine $ Write SYS$OUTPUT "" $ Write SYS$OUTPUT "**********" $ Define/System VERSION_DISK "''P1'" $ If P2 .EQS. "SCAN" $ Then $ Write SYS$OUTPUT "SCANNING disk ''P1'" $ Else $ Write SYS$OUTPUT "SEARCHING disk ''P1'" $ EndIf $ Get_Next_File: $ FileName = F$Search("''P1'[*...]*.*;") $ If FileName .EQS. "" Then Goto No_More_Files $ Version_Number = F$Parse(FileName,,,"Version") - ";" $ If Version_Number .LT. 30000 Then Goto Get_Next_File $ Write SYS$OUTPUT FileName $ Write Report_File FileName $ If P2 .NES. "SCAN" $ Then $ No_Version = F$Parse(Filename,,,"Device") + F$Parse(Filename,,,"Directory") + - F$Parse(Filename,,,"Name") + F$Parse(Filename,,,"Type") $ Purge/Keep=1/NoConfirm 'No_Version' $ Rename/NoConfirm/Log 'Filename' 'No_Version';1 $ Write SYS$OUTPUT "" $ EndIf $ Goto Get_Next_File $! $ No_More_Files: $ Exit $ EndSubRoutine ! Scan_Disk