I have an archive (zipped) file. A user archives it so there is no standard that is being followed. This file has several folders and files in it. But I am only interested in one file 'FOI.zip'. FOI.zip is an archive within a zip file.
Eg: Main file is what I have and needs to be searched.. Possible Structures within Main.zip
1.
/Main.zip
/A
/FOI.zip
/B
/C
2.
/Main.zip
/A
/a.zip
/FOI.zip
/B
/C
3.
/Main.zip
/XYZ
/A
/FOI.zip
/B
/C
In PHP I would like to search for FOI.zip recursively and get the path for FOI.zip. I greatly appreciate any help.
Thank you in advance.
If i understood it well, you need to find a FOI.zip in the archive, is it right?
If yes, you have this sollution:
<?php
system('unzip' . $zip file);
system('find . | grep FOI.zip', $relative_path);
// $relative_path is a where FOI.zip is, if it's empty - means no FOI.zip found.
?>