             while let filePathComponent = enumerator.nextObject() as? String {
                 let path = directory.appendingPathComponent(filePathComponent)
                 let filePath = path.path
-                let directoryName = directory.lastPathComponent
 
                 var isDirectory: ObjCBool = false
                 fileManager.fileExists(atPath: filePath, isDirectory: &isDirectory)
                 if !isDirectory.boolValue {
-                    let fileName = (directoryName as NSString).appendingPathComponent(filePathComponent)
+                    var fileName = filePathComponent
+                    if includeRootDirectory {
+                        let directoryName = directory.lastPathComponent
+                        fileName = (directoryName as NSString).appendingPathComponent(filePathComponent)
+                    }
                     let processedPath = ProcessedFilePath(filePathURL: path, fileName: fileName)
                     processedFilePaths.append(processedPath)
                 }


internal class ZipUtilities {
    
    // File manager
    let fileManager = FileManager.default


    
    
    /**
     Expand directory contents and parse them into ProcessedFilePath structs.
     
     - parameter directory: Path of folder as NSURL.
     
