Ido Naveh Ido Naveh -4 years ago 79
PHP Question

DS_Store file is created on ZipArchive::extractTo

I'm creating a PHP script, which supposed to extract a zip archive stored on the php file directory to a folder.

Everything works well, but when I check te result, I find 2 folders under the directory: a folder with the name of the zip archive, and another folder named

__MACOSX
. I don't know how this folder came there, especially as I'm using Windows 7. Second, in each folder there is a file called
.DS_Store
.

Now, I don't know how these things got there. This is my code:

$zip = new ZipArchive;
if ($zip->open('File.zip')) {
$path = getcwd() . "/details/" . trim($id) . "/";
$path = str_replace("\\","/",$path);
echo $path;
echo $zip->extractTo($path);
$zip->close();
echo 'ok';
} else {
echo 'failed';
}


This is the only code that extracts the zip file, or touching it, and as you can see, there is nothing like
__MACOSX
or
.DS_Store
.

Can you please help me?

Answer Source

File.zip originated on a OSX system. __MACOSX and .DS_Store have 0 usage or bearing on any other OS. Delete / Ignore them and keep trucking.

As an aside, you may want to add the stated file system objects to your project .gitignore.

https://superuser.com/questions/104500/what-is-macosx-folder https://en.wikipedia.org/wiki/.DS_Store

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download