I am using Objective Zip for unzipping a Zipped file and saving to document directory. The unzipping works fine. The individual files in in the zipped file can be written perfectly to the documents directory.
The problem is I cannot write the Sub Folders inside the Zip file as Folders to the documents directory. It is shown as text files with no content.
How can I solve this ? How can I write the folders as Folders to the directory?
below is the code I've used.
NSString *targetFolder = docPath; // Path to Document directory
[unzipFile goToFirstFileInZip];
for (NSString *file in fileArray) {
ZipReadStream *readStream = [unzipFile readCurrentFileInZip];
FileInZipInfo *fileInfo = [unzipFile getCurrentFileInZipInfo];
NSString *fileName = [fileInfo name];
NSLog(@"File Name--- %@",fileName);
NSString *unzipFilePath = [targetFolder stringByAppendingPathComponent:fileName];
if (![fileManager fileExistsAtPath:unzipFilePath]) {
[fileManager createFileAtPath:unzipFilePath contents:nil attributes:nil];
}