#44179 - 2003-08-18 08:51 PM
Multiple locations
|
atiisler
Fresh Scripter
Registered: 2002-07-10
Posts: 34
|
Hi everyone.. I am trying to write code that would search in either one place or the other for a file. I need to identify a file and some users have this file in one location (older installation of program) or another (newer installation of program) and am not sure how to do. Here is my current code: HELP
$sourcefilea = "c:\Lotus\Notes\Data\bookmark.nsf" if not exist($sourcefilea ) $rc=messagebox(" Can not find file " + $sourcefilea, "bookmark.nsf",0) endif
The file Bookmark.nsf can now either be in the directory indicated in code shown or it can be in the following directory
"C:\Program Files\Notes\Data\bookmark.nsf" how can I check both before the if not exist statement...
|
|
Top
|
|
|
|
#44180 - 2003-08-18 08:53 PM
Re: Multiple locations
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
if not exist() and not exist() ? 'file not present' endif
|
|
Top
|
|
|
|
#44181 - 2003-08-18 09:07 PM
Re: Multiple locations
|
atiisler
Fresh Scripter
Registered: 2002-07-10
Posts: 34
|
I am confused... I want the variable $sourcefilea to have the value of names.nsf if it exists in either location. It will not exist in both but may not exist at all...I need to chech both directories.
|
|
Top
|
|
|
|
#44183 - 2003-08-18 09:26 PM
Re: Multiple locations
|
atiisler
Fresh Scripter
Registered: 2002-07-10
Posts: 34
|
Is there a way without creating seperate variables.. Can this be done using the OR statement $sourcefilea = "c:\Lotus\Notes\Data\bookmark.nsf" or "c:\program files\lotus\notes\data\bookmark.nsf"
|
|
Top
|
|
|
|
#44185 - 2003-08-18 09:42 PM
Re: Multiple locations
|
atiisler
Fresh Scripter
Registered: 2002-07-10
Posts: 34
|
So I actually have 6 files I have to search for..
$sourcefile="c:\Lotus\Notes\Data\names.nsf" or "c:\Program Files\Lotus\Notes\Data\names.nsf" if not exist($sourcefile) $rc=messagebox(" Can not find file " + $sourcefile, "names.nsf",0) endif $sourcefilea = "c:\Lotus\Notes\Data\bookmark.nsf" if not exist($sourcefilea ) $rc=messagebox(" Can not find file " + $sourcefilea, "bookmark.nsf",0) endif so and so on for 4 more files
Should I use an array at every file???
|
|
Top
|
|
|
|
#44187 - 2003-08-18 09:59 PM
Re: Multiple locations
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
you could do an array
$found =0 $file[0]='path\file' $file[1]='path\file' $file[2]='path\file' $file[3]='path\file' $file[4]='path\file' for each $try in $file if exist($try) $found=$try endif next if $found ? 'file is '+$found else ? 'File not found' endif
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1452 anonymous users online.
|
|
|