     }
     
     private func generateTemporaryPath(with asset: DKAsset) -> URL {
-        var fileName: String!
+        var directoryName: String!
         if let originalAsset = asset.originalAsset {
             let localIdentifier = originalAsset.localIdentifier
-            fileName = localIdentifier.data(using: .utf8)?.base64EncodedString()
+            directoryName = localIdentifier.data(using: .utf8)?.base64EncodedString()
             
             if let modificationDate = originalAsset.modificationDate {
-                fileName = fileName + String(modificationDate.timeIntervalSinceReferenceDate)
+                directoryName = directoryName + "/" + String(modificationDate.timeIntervalSinceReferenceDate)
             }
             
             if asset.type == .photo {
-                fileName = fileName + String(self.configuration.imageExportPreset.rawValue)
+                directoryName = directoryName + "/" + String(self.configuration.imageExportPreset.rawValue)
             } else {
                 #if swift(>=4.0)
-                fileName = fileName + self.configuration.videoExportPreset + self.configuration.avOutputFileType.rawValue
+                directoryName = directoryName + "/" + self.configuration.videoExportPreset + self.configuration.avOutputFileType.rawValue
                 #else
-                fileName = fileName + self.configuration.videoExportPreset + self.configuration.avOutputFileType
+                directoryName = directoryName + "/" + self.configuration.videoExportPreset + self.configuration.avOutputFileType
                 #endif
             }
         } else {
-            fileName = "\(Date().timeIntervalSinceReferenceDate)"
-        }
-        
-        if !FileManager.default.fileExists(atPath: self.configuration.exportDirectory.path) {
-            try? FileManager.default.createDirectory(at: self.configuration.exportDirectory, withIntermediateDirectories: true, attributes: nil)
-        }
-        
-        DKImageAssetDiskPurger.sharedInstance.addDirectory(self.configuration.exportDirectory)
-        
-        return self.configuration.exportDirectory.appendingPathComponent(fileName)
+            directoryName = asset.localIdentifier
+        }
+        
+        let directory = self.configuration.exportDirectory.appendingPathComponent(directoryName)
+        
+        if !FileManager.default.fileExists(atPath: directory.path) {
+            try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true, attributes: nil)
+        }
+        
+        return directory
     }
     
     static let ioQueue = DispatchQueue(label: "DKPhotoImagePreviewVC.ioQueue")

                } else {
                    asset.fileName = asset.localIdentifier
                }
                
                DKImageAssetExporter.ioQueue.async {
                    let group = DispatchGroup()

        self.configuration = configuration.copy() as! DKImageAssetExporterConfiguration
        
        super.init()
        
        DKImageAssetDiskPurger.sharedInstance.addDirectory(self.configuration.exportDirectory)
    }
    
    /// This method starts an asynchronous export operation of a batch of asset.
