cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python: copy files between folders with different owners

Python: copy files between folders with different owners

Olaf B.2
New member | Level 2

Dear API support,

 

Is it possible to copy files between folders with different owners?  I need to adapt a functioning application for copying files under the same ownership.

 

Thank you for the help.

5 Replies 5

Greg-DB
Dropbox Staff

If you mean you want to copy files between shared folders in a particular account where the shared folders have different owners, yes, you can copy them normally, as long as the account you're using has write permissions in the destination folder:

 

https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_cop...

 

If instead you want to copy files across different accounts entirely, when you have both accounts linked to the app, you can use "copy references" to do so:

 

https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_cop...
https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_cop...

ArgusR
Explorer | Level 4

Hello, 

How can I link another account to my existing app?

And after that, how do I tell files_copy_reference_save that the path to save is for the other account?

Thanks,

Greg-DB
Dropbox Staff

@ArgusR You should implement the OAuth app authorization flow in your app to allow arbitrary users to connect to it. You can find information on how this works in the OAuth guide:

https://www.dropbox.com/developers/reference/oauth-guide

There are OAuth 2 flow helpers in the Python SDK:

https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.oauth.DropboxOAuth2Flow

When using files_copy_reference_save in the Python SDK, you specify the path where you want to save the file or folder in the 'path' parameter:

https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_cop...

ArgusR
Explorer | Level 4

Thank you for your quick reply Greg.

I'm trying to understand the implementation, sorry but I'm new to this.

I only have the developer App inside dropbox, nothing else anywere. I created this app to get the token and use the python script dropbox-uploader (https://github.com/andreafabrizi/Dropbox-Uploader), so I don't have any web or mobile app. 

I want to link two accounts to share some files without having to download and upload again.

There is a easy way to create this link request?

Thanks

Greg-DB
Dropbox Staff

It looks like the third party library you linked to doesn't implement copy references unfortunately, so you won't be able to use that for this without modifications.

You'll need to implement code for linking both users to the app (see the OAuth guide linked earlier) and then the code for getting the copy reference from one account and saving it on the other account (see the documentation for the methods for the Python SDK linked earlier).

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    ArgusR Explorer | Level 4
What do Dropbox user levels mean?