0

I am developing a app like file manager. In this i have created zip folder using any existing folder, it works perfectly fine. For this i have used SSZipArchive API. After zip i send it through mail. It's working fine too.

Now when i try to zip any empty folder, it is not working. Means empty folder does not zip.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sagar
  • 105
  • 1
  • 1
  • 5

2 Answers2

0

Yeah looking at the source code, the method + createZipFileAtPath:withContentsOfDirectory: only appears to care about files:

while ((fileName = [dirEnumerator nextObject])) {
    BOOL isDir;
    NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName];
    [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir];
    if (!isDir) {
        [zipArchive writeFileAtPath:fullFilePath withFileName:fileName];
    }
}

You have two choices:

  1. Fix it yourself and then send a pull request to the author on github and contribute to work you have, yourself, benefited from.
  2. Live with it. It's not clear how an empty folder not appearing in the zip file is an issue anyway.
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • i add the empty folder in zip file successfully. But when unzip this file, empty folder is not there. – Sagar Jan 28 '14 at 14:21
0

Isn't a standard thing to have stub files in directories like that. Some file with no contents.

0xFADE
  • 832
  • 5
  • 7