Page 1 of 1 1
Topic Options
#140294 - 2005-05-25 07:07 PM If Exist- check multiple Files?
eternitybc Offline
Lurker

Registered: 2005-05-25
Posts: 1

If Exist ("c:\image.txt")
ELSE

This code is currently implemented, works great. But now they changed the file name, so we have to check for either file. I tried:


If Exist ("c:\image.txt", "C:\image2.txt")
ELSE

to no avail. It mentions inthe documentation that you can check for mulitple files- what is the correct syntax?

Top
#140295 - 2005-05-25 07:18 PM Re: If Exist- check multiple Files?
NeedANewJob Offline
Fresh Scripter

Registered: 2005-04-01
Posts: 23
If Exist("c:\image.txt") Or Exist("c:\image2.txt")
Else
EndIf

Top
#140296 - 2005-05-25 07:20 PM Re: If Exist- check multiple Files?
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
By using wildcards...

Code:

If Exist("c:\image*.txt")


Top
#140297 - 2005-05-25 07:31 PM Re: If Exist- check multiple Files?
NeedANewJob Offline
Fresh Scripter

Registered: 2005-04-01
Posts: 23
Using wildcards is definitely more elegant, but if image3.txt existed it would also meet the If condition (perhaps unwanted.)
Top
#140298 - 2005-05-25 08:32 PM Re: If Exist- check multiple Files?
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I agree. I was just answering the following question...

Quote:

It mentions in the documentation that you can check for mulitple files- what is the correct syntax?



Top
#140299 - 2005-05-25 08:33 PM Re: If Exist- check multiple Files?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Then use IF EXIST("file1") and EXIST("file3")...


or use and array of files names and FOR...NEXT

by using the loop you could act on individual files that existed or take action if one of more did not exist.
_________________________
Home page: http://www.kixhelp.com/hb/

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
1 registered (StuTheCoder) and 798 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.052 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