cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mjgarcia
Level 2

ExistsDir with Wildcard?

Okay, after a fair amount of searching I've not found anything specifically illuminating about what I'm trying to accomplish.

I'm trying to determine through the course of my install script whether a folder exists at a particular location. The issue is the folder may be named differently for each client. Can ExistsDir work with a wild card? (c:\\Program Files\\folde*.*)

If so, what's the correct syntax?

If you couldn't tell... I'm a bit of a packaging noobie so any assistance is GREATLY appreciated.

Thanks guys!
Labels (1)
0 Kudos
(2) Replies
ch_eng
Level 7

mjgarcia,

It doesn't look like ExistsDir supports wildcards in the parameters. You might have to do something with getting a list of folders and looping through the list and using the Find String Operator (%) until you find it.

http://helpnet.flexerasoftware.com/installshield18helplib/mergedProjects/installshield18langref/LangrefFindAllDirs.htm
http://helpnet.flexerasoftware.com/installshield18helplib/mergedProjects/installshield18langref/LangrefFind_string.htm

HTH
0 Kudos
mjgarcia
Level 2

That definitely did help!

Thought I'd give back and post what I came up with. Thanks again!

QueryFolders("Root directory, will search subdirectories",
"String to search for within folder names",
"Error to display if folder found");

function QueryFolders(szRootPath, szVariable, szErrorMsg)

NUMBER nResult;
LIST listItemsID, listFoldersID;
STRING szString;

begin

if (MODE=SILENTMODE) then
listItemsID = ListCreate (STRINGLIST);
listFoldersID = ListCreate (STRINGLIST);
if (ExistsDir(szRootPath) = EXISTS) then
if (listItemsID = LIST_NULL) || (listFoldersID = LIST_NULL) then
abort;
endif;
nResult = GetFolderNameList (szRootPath, listItemsID, listFoldersID);
nResult = ListGetFirstString (listFoldersID, szString);
while (nResult != END_OF_LIST)
if (szString % szVariable) then
abort;
endif;
nResult = ListGetNextString (listFoldersID, szString);
endwhile;
ListDestroy (listFoldersID);
ListDestroy (listItemsID);
endif;
else
listItemsID = ListCreate (STRINGLIST);
listFoldersID = ListCreate (STRINGLIST);
if (ExistsDir(szRootPath) = EXISTS) then
if (listItemsID = LIST_NULL) || (listFoldersID = LIST_NULL) then
MessageBox ("Unable to create lists.", SEVERE);
abort;
endif;
nResult = GetFolderNameList (szRootPath, listItemsID, listFoldersID);
nResult = ListGetFirstString (listFoldersID, szString);
while (nResult != END_OF_LIST)
if (szString % szVariable) then
MessageBox (szErrorMsg, SEVERE);
abort;
endif;
nResult = ListGetNextString (listFoldersID, szString);
endwhile;
ListDestroy (listFoldersID);
ListDestroy (listItemsID);
endif;
endif;
end;
0 Kudos