I am trying to extract a .tar archive using PHP. I am using code like this:
$phar = new PharData('test.tar'); $phar->extractTo('/home/user/newtest');
It works fine, but if my archive contains an empty directory , it is not extracted by the specified code. So, if my .tar file has this structure:
user@computer :~/test$ tar -tvf test.tar drwxrwxr-x user/user 0 2012-12-07 22:35 dir1/ -rw-rw-r-- user/user 798 2012-10-28 23:41 dir1/articles.txt drwxrwxr-x user/user 0 2012-12-07 22:35 emptyDir/ -rw-rw-r-- user/user 834 2012-09-15 22:47 main.html
I get after unpacking:
user@computer :~/newtest$ ls -l drwxrwxr-x 2 user user 4096 Dec. 7 22:35 dir1 -rw-rw-r-- 1 user user 834 Sep. 15 22:47 main.html
So, the empty 'emptyDir' is not retrieved .
Does anyone know how to fix this?
Thank you in advance for your help!
source share