sdk - How to extract archive file correctly in php-opencloud
im using version 1.7 of php-opencloud
heres some part of my code.
$cloud = new Rackspace(RACKSPACE_US, $credentials); $storage = $cloud->objectStoreService('cloudFiles', 'SYD','publicURL'); $container = $storage->getContainer('testing'); $gz_file = 'test.tar.gz'; $storage->bulkExtract('', $gz_file);
this code is working the problem is when its extracted only the first level of directories are extracted correctly, inside it the all directory name is concatenated with the filenames.. it did not create a directory for each. im sure im missing something here.
please see screenshot: http://i.stack.imgur.com/nfXlU.png
Correct, what you are seeing is the expected behavior. Cloud Files has no concept of nested directories (namely, there is only one top-level of containers). However, you can simulate a hierarchy, like in your screenshot, by adding a delimiter (like a '/') to the object name.
So if your archive has a nested structure, each file path is flattened into a string before being uploaded, and that string is used as the object name.
According to the php-opencloud docs, if you omit the container name (like you are doing in your example), then containers will be created based on the filenames inside the archive.