Juan
Juan

Reputation: 2103

Recursive Zip directory in PHP Windows?

I'm using this code to zip a folder

 D:\VIRTUAL\consuladoperurio.com.br\WWW\siscons\test\wordtemplatedownload\pasta 

into test.zip. The folder "pasta" has the follow tree

pasta
    subfolder
        styles.xml

When I run the code

$wordtemplatedownloadpath ="D:\\VIRTUAL\\consuladoperurio.com.br\\WWW\\siscons\\test\\wordtemplatedownload\\"
Zip($wordtemplatedownloadpath."pasta", $wordtemplatedownloadpath."test.zip");

and then extract test.zip I get the folder and file

enter image description here respectively. When I need the first tree.

I'm trying to replace '/' to '\' but don't work. How I will be able to solve that?

Upvotes: 1

Views: 79

Answers (1)

Bizmate
Bizmate

Reputation: 1872

I will concentrate on your last question "I'm trying to replace '/' to '\' but don't work. How I will be able to solve that?" as at the moment it is unclear what you are asking about.

But if you are having problems specifying a path to your directory try to use the constant DIRECTORY_SEPARATOR within your path definition

Example

$wordtemplatedownloadpath ="D:" . DIRECTORY_SEPARATOR . "VIRTUAL" . DIRECTORY_SEPARATOR . "consuladoperurio.com.br" . DIRECTORY_SEPARATOR . "WWW" . DIRECTORY_SEPARATOR . "siscons" . DIRECTORY_SEPARATOR . "test" . DIRECTORY_SEPARATOR . "wordtemplatedownload" . DIRECTORY_SEPARATOR ;

Please let me know if this fixes your problem

Upvotes: 1

Related Questions