cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Python: copy files between folders with different owners

New member | Level 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
Highlighted

Re: Python: copy files between folders with different owners

Dropboxer
Dropboxer

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...

Highlighted

Re: Python: copy files between folders with different owners

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,

Highlighted

Re: Python: copy files between folders with different owners

Dropboxer
Dropboxer

@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...

Highlighted

Re: Python: copy files between folders with different owners

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

Highlighted

Re: Python: copy files between folders with different owners

Dropboxer
Dropboxer

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).

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?