You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Mark L.45
8 years agoCollaborator | Level 9
Renaming a file/folder using swifty dropbox
Hi, Sorry, a stupid question. I want to rename a file within my dropbox using the swifty dropbox API. But I don't find a rename method and I wanted to check with you the procedure I should be usi...
Mark L.45
8 years agoCollaborator | Level 9
Thanks Greg,
Here the bear bones code for your readers I put togther; it swaps two files.
let randx = Int(arc4random_uniform(32768))
let sourcePathC = sourcePathB + String(randx)
let client = DropboxClientsManager.authorizedClient!
_ = client.files.move(fromPath: sourcePathA, toPath: sourcePathC, allowSharedFolder: false, autorename: true)
.response { response, error in
self.theApp.isNetworkActivityIndicatorVisible = true
if let response = response {
_ = client.files.move(fromPath: sourcePathB, toPath: sourcePathA, allowSharedFolder: false, autorename: true)
.response { response, error in
if let response = response {
_ = client.files.move(fromPath: sourcePathC, toPath: sourcePathB, allowSharedFolder: false, autorename: true)
.response { response, error in
if let response = response {
self.theApp.isNetworkActivityIndicatorVisible = false
}
}
}
}
}
}
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 6 years agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!