I'm using swift code but is not changed file extension.
This my swift code
let url = NSURL(fileURLWithPath: outputURL.path).deletingPathExtension?.appendingPathExtension("mp3")
You are just creating a URL
and then changing that URL
. You are not actually operating on any file.
To rename a file, call FileManager.default.moveItem(at:to:)
. Pass the file URL as the first argument, and the file URL with the new name as the second argument.
let newURL = outputURL.deletingPathExtension().appendingPathExtension("mp3")
try FileManager.default.moveItem(at: outputURL, to: newURL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With