Page 1 of 1 1
Topic Options
#132288 - 2005-01-11 11:50 PM Script to check for two files, then creating a file if not
Slacker Offline
Lurker

Registered: 2005-01-11
Posts: 3
Loc: Shelton, CT
I am creating a script that needs to check for two files. If they exist it needs to terminate. However if they don't exist I need to create a blank file. This is what I have, but when I add the "OR" statement it does not work. What am I doing wrong and is there another way to create this file besides using the open command.

IF EXIST( "C:\WINFISH\AUTOUPDT.FLG" )OR( "C\WINFISH\NOUPDT.FLG" )

GOTO END

ELSE

OPEN (1,"C:\WINFISH\AUTOUPDT.FLG",1)

ENDIF

:END

Exit
_________________________
Matt

Top
#132289 - 2005-01-12 12:04 AM Re: Script to check for two files, then creating a file if not
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
1. gotos are BAAD!!

try this

Code:

IF EXIST("C:\WINFISH\AUTOUPDT.FLG") OR EXIST("C\WINFISH\NOUPDT.FLG")
;do nothing
ELSE
OPEN(1,"C:\WINFISH\AUTOUPDT.FLG",1)
ENDIF



If the files are found.. the ELSE statment will never be ran. So there is no need to GOTO around the ELSE statment.


Top
#132290 - 2005-01-12 08:00 PM Re: Script to check for two files, then creating a file if not
Slacker Offline
Lurker

Registered: 2005-01-11
Posts: 3
Loc: Shelton, CT
Thank you, but I just tested it and if the NOUPDT.FLG is there it still runs the else.
_________________________
Matt

Top
#132291 - 2005-01-12 08:02 PM Re: Script to check for two files, then creating a file if not
Slacker Offline
Lurker

Registered: 2005-01-11
Posts: 3
Loc: Shelton, CT
Disregard my last comment. There was a typo in your example. You were missing a ":". It works great! Thank you!
_________________________
Matt

Top
#132292 - 2005-01-15 04:08 PM Re: Script to check for two files, then creating a file if not
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Code:

IF NOT (EXIST('C:\WINFISH\AUTOUPDT.FLG') AND EXIST('C:\WINFISH\NOUPDT.FLG'))
OPEN(1,'C:\WINFISH\AUTOUPDT.FLG',1)
ENDIF


would be better
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.051 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org