Hi Scott,

how about OPENSEQ?

or if the files are in your local account (and are not subdirectories)

OPEN "&UFD&" TO UFD ELSE STOP

READV EXISTS FROM UFD, FILENAME, 0 ON ERROR
   ANS = @FALSE
END THEN
   ANS = @TRUE
ELSE
   ANS = @FALSE
END

HTH,


Craig

Scott Ballinger wrote:
I have a standard subroutine that I use in UV BASIC when I need to check for
the existence (or non-existance) of a unix file:

     FILE.TEST.SUB
0001 SUB(FILENAME,ANS)
0002 * return ans = 1 if filename exists
0003 * redirect to bit bucket to suppress 'not on file' msg
0004 * filename includes full path to file
0005 EXECUTE "SH -c 'ls -d ":FILENAME:" 2> /dev/null'" CAPTURING XXX
0006
0007 FN = FILENAME
0008 CONVERT "\" TO "" IN FN  ;*  in case we escaped any special characters
0009
0010 IF XXX<1> EQ FN THEN ANS = 1 ELSE ANS = 0
0011
0012 RETURN
0013

It works fine, but seems pretty slow, particularly if I am churning though
thousands of tests (like from a big select list).
Can anyone suggest a faster/more efficient way to test if a unix level file
exists from inside UV BASIC ?

Thanks,
/Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/



--
Craig Bennett

Director
Amajuba Pty Ltd

Phone: 02 9987 0161
Mobile: 0412448781
Fax: 02 8456 5943
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to