Another easier technique is
SET ERROR VAR vERR
OUTPUT C:\TEMP
SET VAR vHold = .vERR
OUT SCR
If vHold = 0 then - file created, not directory
Erase C:\TEMP
MD C:\TEMP
Endif
Dennis McGrath
________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Dennis McGrath
Sent: Friday, September 25, 2009 9:31 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Checking for a subdirectory in Rbase 9
You could always output the results of
DIR C:\TEMP
To a file and load that in a temp table
If any of the lines contain <DIR> then it is a directory.
If not, you can safely delete it and create the directory.
Dennis McGrath
________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Friday, September 25, 2009 9:19 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Checking for a subdirectory in Rbase 9
Bill: One word of caution using the technique below. CHKFILE
does not distinguish between checking for a file and checking
for a directory. I always used this code to check for the existence
of a C:\TEMP directory (my usual Scratch directory) and create it
if it doesn't exist. One user would always have program crashes,
and it turns out that he had no C:\TEMP directory, but he had a
file on his computer called C:\TEMP with no extension! So it
never created the directory! What are the odds?
I thought at first I could do "ERASE C:\TEMP" first, thinking it would
not remove the directory and I specified no files to erase, but it turns
out that that erases all the files in that directory, so that's not good
either... So I take my chances that it'll never happen again.
Karen
Bill,
Use the CHKFILE function of R:BASE to achieve your goal.
Here's how:
SET VAR vChkFile = (CHKFILE('G:\AC'))
IF vChkFile <>1 THEN
MD G:\AC
ENDIF
That's all there is to it!
Very Best R:egards,
Razzak.