Potz
14th August 2006 21:30 UTC
File searching
is there anyway I can search for a file by using part of the file name. For example if I was searching for File#1.zip but there were multiple File#.zip's and all I want is File#1.zip. I thought maybe I could use * like *1.zip but I found out that it doesn't work that way.
here is my code
ZipDLL::extractall "$EXEDIR\IIMS_Base_Software_20060501.zip" "$INSTDIR" "<ALL>"
all I want to search for is IIMS_Base_Software because the rest is due to change.
Comperio
14th August 2006 21:36 UTC
Should be able use wildcards with FindFirst FindNext commands (see help files for usage).
For your particular issue, use "?" as your wild card.
Example:
"File?.zip" would file names of File1.zip, File2.zip, FileA.zip, etc.
*1.zip, in contrast, will match anything that ends with "1.zip", which could match more than just those named "File1.zip"
Potz
15th August 2006 14:07 UTC
So I should be able to do something like this right?
ZipDLL::extractall "$EXEDIR\IIMS_Base_Software_?.zip" "$INSTDIR" "<ALL>"
or is there another way it has to be done? I did look at the examples for FindFirst and FindNext commands but I couldn't figure out how the example worked.
Afrow UK
15th August 2006 14:14 UTC
You need to use FindFirst, FindNext and FindClose.
ClearErrors
FindFirst $R0 $R1 "$EXEDIR\IIMS_Base_Software_?.zip"
Loop:
IfErrors Done
# Do whatever with "$EXEDIR\$R1" here.
ClearErrors
FindNext $R0 $R1
Goto Loop
Done:
FindClose $R0
-Stu
Potz
15th August 2006 18:04 UTC
I seem to be getting an error with the FineClose $R0 part.
here is my code:
ClearErrors
FindFirst $R0 $R1 "$EXEDIR\IIMS_Base_Software_?.zip"
Loop:
IfErrors Done
ZipDLL::extractall "$EXEDIR\$R1" "$INSTDIR" "<ALL>"
ClearErrors
FindNext $R0 $R1
Goto Loop
Done:
FineClose $R0
here is the error I get
ClearErrors
FindFirst: spec="$EXEDIR\IIMS_Base_Software_?.zip" handle=$R0 output=$R1
IfErrors ?Done:
File: "ZipDLL.dll"->"$PLUGINSDIR\ZipDLL.dll" [compress] 86234/167424 bytes
Plugin Command: extractall $EXEDIR\$R1 $INSTDIR <ALL>
ClearErrors
FindNext: handle=$R0 output=$R1
Goto: Loop
Invalid command: FineClose
Error in script "C:\Documents and Settings\l.iw_user\Desktop\IIMSInstall project\main\warnInstall.nsi" on line 85 -- aborting creation process
Afrow UK
15th August 2006 18:07 UTC
Typo, it's FindClose not FineClose.
-Stu
niteflyer
15th August 2006 18:08 UTC
That's a typo. Use FindClose instead of FineClose.
Potz
15th August 2006 18:35 UTC
ok thanks I got that fixed now. There are no errors but it won’t unzip the file. I am guessing it isn't finding it but it is there because I can use $EXEDIR\IIMS_Base_Software_20060501.zip and that works. I don't see why but I think the wildcard isn't working. Any suggestions?
Afrow UK
15th August 2006 18:42 UTC
? is for single characters only. 20060501 is more than 1 character. Use * instead of ?
-Stu
Potz
15th August 2006 18:48 UTC
oh ok cool. I was wondering what the differance between the two was. Thanks again :)