deltree.com 835 B

12345678910111213141516171819202122232425262728293031323334
  1. $! DELTREE.COM
  2. $
  3. $ call deltree 'p1'
  4. $ exit $status
  5. $
  6. $ deltree: subroutine ! P1 is a name of a directory
  7. $ on control_y then goto dt_STOP
  8. $ on warning then goto dt_exit
  9. $ _dt_def = f$trnlnm("SYS$DISK")+f$directory()
  10. $ if f$parse(p1) .eqs. "" then exit
  11. $ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")'
  12. $ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE")
  13. $ _fp = f$parse(".DIR",p1)
  14. $ dt_loop:
  15. $ _f = f$search(_fp)
  16. $ if _f .eqs. "" then goto dt_loopend
  17. $ call deltree [.'f$parse(_f,,,"NAME")']*.*
  18. $ goto dt_loop
  19. $ dt_loopend:
  20. $ _fp = f$parse(p1,".;*")
  21. $ if f$search(_fp) .eqs. "" then goto dt_exit
  22. $ set noon
  23. $ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp'
  24. $ set on
  25. $ delete/nolog '_fp'
  26. $ dt_exit:
  27. $ set default '_dt_def'
  28. $ goto dt_end
  29. $ dt_STOP:
  30. $ set default '_dt_def'
  31. $ stop/id=""
  32. $ exit
  33. $ dt_end:
  34. $ endsubroutine