How to get if the file with same name already exists on document directory iOS swift?

Solution:

The below code used for check if the file with the same name already exists in the document directory.And it will remove the existing file.

code:

if fileManager.fileExists(atPath: mergeAudioFiles.path!) {
            do{
                try fileManager.removeItem(atPath: path!)
            } catch {
                //Do nothing
            }
        }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift