Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if file exists not working

Status
Not open for further replies.

urdrak

Programmer
Jul 13, 2011
1
CA
Hi everyone I'm new to these forums and really like them.

I've got somewhat of a simple question...

I want to know how to check if a file exists.

by searching the forums, I found some code and made this code to try the exemple I found.

ASSIGN FILE-INFO:FILE-NAME = "filepath".
IF NOT FILE-INFO:FILE-TYPE BEGINS "F" THEN DO:
OUTPUT TO filepath. /*to create the file*/
OUTPUT CLOSE.
END.

after this step I try to read the file with INPUT FROM filepath.

however, I still get the error that the file does not exists. So I'm guessing this does not enter the if condition...

any help would be apreciated.

thank you,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top