From:	RTPARK::RLB  "Bob Boyd 8*565-3627  15-May-1988 0304" 15-MAY-1988 03:19
To:	ALL_MANAGERS
Subj:	VAX/VMS Trash Can Manager -- in case you haven't got one already

Message created @ 15-MAY-1988 02:59:08.79

Here is a TRASH CAN MANAGER -- put this in your utility directory.

I think that this probably does a decent job of answering the requests people
have had for this type of thing.  It is fairly self explanatory.

Define the symbol TRASH to point to the procedure.
Define the symbol EMPTY*TRASH be "@procedure EMPTY"  

-- upon first invocation the procedure will define these if they are not
already defined. 

If you have ideas on how to do this better or you find problems with this
one, please let me know at the address listed at the end of this message.

================================ 8< cut here ================================
....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by RLB
$! on Sunday 15-MAY-1988 02:58:01.63
$!
$! It contains the following 1 file:
$! TRASH.COM
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="TRASH.COM"
$ Check_Sum_is=289960105
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$! TRASH.COM -- move file(s) to the trash bin for later disposal.
X$! p1 -- if = EMPTY then will delete all files from the WASTEBASKET
X$! p2 -- name of wastebasket if not null, and P1=EMPTY
X$!       Otherwise concatenate in RENAME command
X$! Author:  RL Boyd, GE Microelectronics Center
X$! Date: 14 MAY 1988
X$!
X$ vfl = f$ver(0+f$trnlnm("debug$dcl"))
X$ set noon
X$ proc = f$parse(";0",f$environment("procedure"))
X$ if f$type(trash).eqs."" then $ trash == "@"+proc
X$ if f$type(emptytrash).eqs."" then $ empty*trash == trash+" EMPTY"
X$ set symbol/scope=(noglobal,nolocal)
X$! set up logical names necessary to verify/create trash can directory
X$ root_device = f$getdvi("sys$disk","fulldevnam")-"_"
X$ root_directory = f$parse("",,,"directory")-"]"+".]"
X$! 
X$ if f$trnlnm("login_root").eqs."" then -
X$`009define/job/nolog/tran=conc login_root 'root_device''root_directory'
X$ if f$trnlnm("trash_can").eqs."" then -
X$ `009define/job/nolog trash_can login_root:[trash_can]
X$! This may need alteration for dealing with "other" directory trees.
X$! form the trash can using the LOGIN_ROOT
X$ if f$parse("trash_can:").eqs."" then -
X$`009create/dir trash_can:/log/prot=(s:rw,o:rw)
X$! what if it's in another account?  Well, we'll worry about that later.
X$! see if they wanted to EMPTY the trash.
X$ if f$loc("EMPTY",f$edit(p1,"upcase,trim")).lt.1 then $ goto EMPTY_TRASH
X$! lets put it in the trash for later disposal.
X$ rename 'p1' trash_can:'p2''p3'/new_version
X$EXIT:
X$  exit ! 'f$ver(vfl)'
X$EMPTY_TRASH:
X$! really get rid of the files now.  This should be done daily if not sooner.
X$ delete = "delete"
X$ trash_can = "trash_can:"
X$ if p2.nes."" then $ trash_can = p2
X$ if f$search(trash_can+"*.*;").eqs."" then $ goto EXIT
X$ write sys$output "Emptying the trash...",f$time()
X$ delete 'trash_can'*.*;*'p3''p4'
X$ write sys$output "Trashcan is now empty. ",f$time()
X$ goto EXIT
X$
X$!Last Modified:  15-MAY-1988 02:57:34.18, By: RLB 
$ GoSub Convert_File
$ Exit
============================= End of Text to Cut =============================


-----------------------------------------------------------------
 Bob Boyd                     Usenet:    rlb@rtpark.ge.com
 GE Microelectronics Ctr.     Internet:  rlb%rtpark.ge.com@mcnc           
 POB 13049, MS 7T3-01         BitNet:    rlb%rtpark.ge.com@relay.cs.net
 RTP, NC 27709-3049           Voice:     (919)549-3627 
 GE DECnet: RTPARK::RLB       GE DIALCOMM:  8*565-3627  PROFS: SSAVRNA,MECRLBT
