#Exists
3 messages in this thread
For reasons that I cannot figure, the exists function in this routine always
returns 0. Can anyone tell me why?
address command
'requestfile >ram:rq'
if RC > 0 then do say "No file selected" exit
end
if ~open(1list,'ram:rq','r') then exit
RESULT = readln(1list) parse var RESULT lead '.' num'.' trail
do i=1 to 9999
fn= lead'.'i'.'trail
say i fn exists(fn)
if ~exists(fn) then leave
'rename >nil: ' fn 'as' lead'.'right('000'i,4)'.'trail end
ANy help would be appreciated.
-ash
Are the filenames you're passing to exists() absolute or relative paths? You
may have a problem with the current directory of the ARexx program being
different from the files. Use pragma('dir') to check the CD of the ARexx
program.
And as a general debugging aid, put a TRACE R instruction near the top of your
program.
-Bill Hawes
Bill
Found out what is going on. requestfile returns "filename" instead of filename,
which confuses exists().
-ash