I use the following commands to create the EPUB file:
system ("zip -q0Xj $zipFile mimetype") ;
system ("zip -qXr9Dj $zipFile $myDir/mimetype $myDir/content.opf $myDir/index.html $myDir/stylesheet.css $myDir/toc.ncx $myDir/META-INF $myDir/META-INF/container.xml") ;
The problem is the the "j" option removes the path from all files, but I need the zip file to have all these files in the root of the zip except the META-INF directory and its file containes.xml must be at the root of the zip file.
So how can I create a zip file containing just these files and that one directory without the full path?
Specifying $myDir/META-INF and $myDir/META-INF $myDir/META-INF/container.xml both with the -r flag is redundant, as with -r it will traverse the directory tree and add everything inside.
You could call zip one more time, without the -j flag, to add that directory:
system ("zip -q0Xj $zipFile mimetype") ;
system ("zip -qXr9Dj $zipFile $myDir/mimetype $myDir/content.opf $myDir/index.html $myDir/stylesheet.css $myDir/toc.ncx");
system("zip -qXr9D $zipFile $myDir/META-INF");
This won't work as $myDir is in a form of "/var/www/customers/myaccount" so also this path will be included into the zip file.
So what I need is create a ZIP file of a remote diretory's contents so that also the META-INF folder will be included into the zip file but the parent folder structure is omitted.
Personally, I doubt it. It's not like tar, where each platform rolls their own; zip is usually just info-zip everywhere you go. And it does go nearly everywhere.