$! ********************************************************************** $! * RMDIR.COM * $! * Delete the specified directory file. RMDIR will automatically * $! * change the protection of the directory to O:RWED before * $! * deleting the file. * $! * * $! * Format: RMDIR [-F] [device:][dir]directory[.DIR] * $! * * $! * If the -F flag is specified, all files in all subdirectories * $! * and all subdirectories of the specified directory will also be * $! * deleted. * $! * * $! * 26-AUG-1999 RDJ Command Procedure Creation. * $! ********************************************************************** $ Default = F$Environment("Default") + ".DIR;1" $ DEL$_FILNOTDEL == %x109311f0 ! file not deleted warning $ CLI$_INSFPRM == %x3804a ! insufficient parameters message $ RMS$_FNF == %X18292 ! file not found error $ SS$_NORMAL == 1 ! normal successful completion $ New_Protection == "(O:RWED)" ! new protection for dir to delete $! $ If F$Edit(P1,"Trim,UpCase") .EQS. "-F" $ Then $ Force = "TRUE" $ Dir2Del = F$Edit(P2,"Trim,UpCase,UnComment") $ Else $ Force = "FALSE" $ Dir2Del = F$Edit(P1,"Trim,UpCase,UnComment") $ EndIf $ If Dir2Del .EQS. "" Then Exit CLI$_INSFPRM $ Device = F$Parse(Dir2Del,Default,,"Device") $ Directory = F$Parse(Dir2Del,Default,,"Directory") $ Name = F$Parse(Dir2Del,Default,,"Name") $ Type = F$Parse(Dir2Del,Default,,"Type") $ Version = F$Parse(Dir2Del,Default,,"Version") $ Filename = Device + Directory + Name + Type + Version $ If Force Then Call Delete_Sub_Files 'Device' 'Directory' 'Name' $ DirFile = Device + Directory + Name + Type + Version $ If F$Search(Filename) .EQS. "" Then Exit RMS$_FNF $ Set File/Protection='New_Protection' 'FileName' $ Delete/Log/NoConfirm 'Filename' $ If F$Type(New_Protection) .NES. "" Then - Delete/Symbol/Global New_Protection $ Exit SS$_NORMAL $! $! ********************************************************************** $! * Delete_Sub_Files: Delete all files in a named directory. * $! * P1 = device name * $! * P2 = root directory name * $! * P3 = name of directory to delete files from * $! * Example: Call Delete_Sub_Files USER1: [USERS.JOHNSON] TEMP * $! ********************************************************************** $ Delete_Sub_Files: SubRoutine $ FileSpec = P1 + P2 - "]" + "." + P3 + "...]" $ Set File/Protection='New_Protection' 'FileSpec'*.*;* $ Deloop: $ Delete/Log/NoConfirm 'FileSpec'*.*;* $ If $Status Then Goto Deloop $ If $Status .EQ. DEL$_FILNOTDEL Then Goto Deloop $ Exit $ EndSubRoutine ! Delete_Sub_Files