Check that file exists: Difference between revisions
Content added Content deleted
m (→version 1: elided the checking if a named directory exists.) |
|||
Line 1,941: | Line 1,941: | ||
{{works with|Personal REXX}} |
{{works with|Personal REXX}} |
||
{{works with|Regina}} |
{{works with|Regina}} |
||
<lang rexx>/*REXX |
<lang rexx>/*REXX program creates a new empty file and directory in current directory and root dir.*/ |
||
fn= 'input.txt' /*default name of a file. */ |
|||
fn='input.txt' |
|||
⚫ | |||
dn='docs' |
|||
@.1='current directory'; |
@.1= 'current directory'; @.2= 'root directory' /*messages used to indicate which pass.*/ |
||
parse upper version v |
parse upper version v /*obtain name of the REXX being used. */ |
||
regina= pos('REGINA', v)\==0 /*is this the Regina REXX being used? */ |
|||
do j=1 for 2; say /* [↑] perform these statements twice.*/ |
|||
if stream(fn, 'C', "QUERY EXISTS")=='' then say 'file ' fn " doesn't exist in the" @.j |
|||
else say 'file ' |
else say 'file ' fn " does exist in the" @.j |
||
if |
if j==1 then if regina then call chdir '\' /*use Regina's version of CHDIR. */ |
||
else call doschdir '\' /*PC/REXX & Personal REXX version. */ |
|||
end /*j*/ /*now, go and perform them again. */ |
|||
/*stick a fork in it, we're all done. */</lang> |
|||
end /*j*/ /*now, go and perform them again.*/ |
|||
⚫ | |||
===version 2=== |
===version 2=== |