Gets the index of a given file.

Syntax

Index = SRP_Zip("FindFile", ZipHandle, File)

Returns

Index of the file if found, or 0 if not found or if there was an error.

Parameters

NameDescription
ZipHandle Handle to an opened zip file. 
File Name of the file to find.

Remarks

Call this service to get the index of a known file name. If you already called GetFileList, then you do not need to call this method because you can use its return value to determine the index. Instead, use this method when you already know the name of the file you need.

The File parameter must include any subdirectories associated to it. For example, passing "MyImage.BMP" will fail if only "Images\MyImage.BMP" exists in the zip file.

Example

// Get the index of a known file
hZip = SRP_Zip("Open", "C:\MyFile.zip")
If hZip EQ 0 then
   Call Msg(@Window, SRP_Zip("GetLastError"))
end else
   FileIndex = SRP_Zip("FindFile", hZip, "Images\MyImage.BMP")
   If FileIndex NE 0 then
       // Use the file index to extract or remove here
   end
   SRP_Zip("Close", hZip)
end
  • No labels