it throws exception while moving files using parallel.foreach functionality in c#
HERE My request
await dbx.Files.MoveV2Async("/rootfolder/filename", "rootfolder/movedfile/filename")
dbx is my dropbox client
can you Share code with me using .net sdk for moving files parallel manner.
The MoveV2Async method is the right way to move an existing file or folder, so it looks like you already have the right idea. It sounds like you're getting the 'too_many_write_operations' error though.
The 'too_many_write_operations' error indicates "lock contention". That's result of how Dropbox works on the backend. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This error indicates that there was simultaneous activity in the account or shared folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention here:
In short, to avoid this error, you should avoid making multiple concurrent state modifications. E.g., don't issue multiple such requests at a time, and use batch endpoints whenever possible. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you may also want to implement automatic retries in your app.
I tried batch Moved as well but that's also not working for me . Suppose I have 20 files in one folder and i try to move that folder to another with files it's moving but out of 20 only 13 files moved and other seven not remain in that folder so i am asking for any way or method that can help me to move entire folder as fast as possible and give me some code as well for moving 20 files from one folder to another it's request.
(2)so are you saying that i can't move file parallel in c#?
If you want to move individual files or folders, using MoveV2Async is the right way to do so. In that case though, if you have multiple to move, you would do need to do so serially, as calling MoveV2Async multiple times in parallel will likely cause lock contention.
If you want to move multiple items at one time, it's better to use one call to MoveBatchV2Async instead. That will allow you to move multiple items at once without causing lock contention with yourself. It is still possible for this to hit lock contention with other activity in the account though, so you do still need to implement error handling around this.
It sounds like you already tried that, so if it's not working as expected, please share the relevant code and error you're getting.
Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.
Not the right discussion for you? Find out what else our Community has to say about API Support.
Or, search our Help Center for even more.