PDA

View Full Version : Locating existing file



Joe Snyder
12-18-2005, 08:53 PM
I am trying to determine if a file exists anywhere on a particular drive. Ideally I need to know if this file is anywhere on the installation machine. Have looked at "If File/Folder" and "Search for File" functions but both seem to require that the path be specified. Is there a way to find a file by simply supplying C: and the filename argument?

linder
12-18-2005, 11:54 PM
Joe,

The Search for File function allows you to search for a specific file in the local or network file system and places the location in a variable.

If the function succeeds, the %_SB_ERRORCODE% return value is nonzero. If the function fails, the return value is zero.

Does this help?

Joe Snyder
12-19-2005, 08:18 AM
I must be be missing something.

Search for File function
Variable %FILEFOUND%
Filename FMGMASTR.EXE
Path to search: %DRIVE_LETTER_TO_TEST%\ (tried without \ also)
Return List of all matches is ON

Debugger shows %DRIVE_LETTER_TO_TEST% to contain D: from previous GetListItem function.

After execution:
%SB_ERRORCODE%= empty
%FILEFOUND%= empty

I know there are several occurances of the FMGMASTR.exe file on this drive.
Attempted to send stripped down script but zip file is too large for submission as an attachment.

linder
12-19-2005, 08:30 AM
Joe,

I'll check this.

BTW, what happens if you enter D:\ in "Path to search" (instead of %DRIVE_LETTER_TO_TEST%\)

Thanks,

linder
12-19-2005, 08:50 AM
Joe,

Just checked this and it works fine here on our machines. I am using the following:

Set Variable %DRIVELETTERTOTEST% to c:
Set Variable %FILEFOUND% to ""
Set Variable %FILEFOUND% to Search for File("FMGMASTR.EXE")
Display Message Box "%FILEFOUND%\n\n%_SB_ERRORCODE%\n\n%DRIVELETTERTOTE ..." -- ""

FMGMASTR.EXE is in c:\general and the installer detected the file.

Joe Snyder
12-19-2005, 08:54 AM
Friedrich:

That works as advertised. :)

linder
12-19-2005, 09:39 AM
Could you please send me a demo script where it does not work? All our test scripts (with drive variables) work fine in build 1354.

Thank you!