home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / ibm1 / do101j2.arj / EXIST.SCR < prev    next >
Text File  |  1991-12-13  |  974b  |  31 lines

  1. .pg wi full clr cy
  2.     COMMAND NAME»gray«: »%t« IfExists »ye«
  3.  
  4.     /EXIST {Filename}
  5. /cw
  6.     If the file »cy«{Filename}»#« exists, »%t«DO»#« branches to "»ye«:EXISTOK»#«". If
  7.     »cy«{Filename}»#« does not exist, »%t«DO»#« branches to "»ye«:EXISTERROR»#«". Any
  8.     variables in »cy«{Filename}»#« are expanded. »wh«Full filenames,
  9.     including sub-directories can be checked.
  10. »gr«
  11.     NOTE»gray«: »#«The »cy«{Filename}»#« must be valid. An invalid filename will
  12.     result in a branch to "»ye«:EXISTERROR»#«".
  13. .pg clr
  14.     You can enter a file name (we're using the »%t«/GETS»#« command)
  15.     and see if the file exists. The sequence continues until you hit
  16.     »bo«<Enter>»#« in response to the prompt:
  17.  
  18. /SET DefaultString ""
  19. /REPEAT
  20. /GETS MyFile DefaultString "    Filename: "  "" UC
  21. /IF %Myfile NE "" EEND
  22. |/EXIST %MyFile
  23. :EXISTOK
  24.     %Myfile Exists
  25. /GOTO EEND
  26. :EXISTERROR
  27.     %MyFile does NOT exist
  28. :EEND
  29. /UNTIL %MyFile EQ ""
  30. /ENDEXEC CLEAR
  31.