cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Discuss Dropbox Developer & API

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

Help with python script uploading images to already created folders

Help with python script uploading images to already created folders

DeeG2009
Explorer | Level 3

I am looking for some assistance with a script i am trying to get to work to transfer images from a windows server to a dropbox account. For the life of me i cannot get it to stop creating new folders. I am trying to get it to upload to existing folders using the destination folder that appears in the browser url string of the desired folder. Anyone willing to help me out on this ill be glad to share the script, i am very green to all of this so i am hoping it is just something silly i am overlooking. Thanks in advance. 

15 Replies 15

Greg-DB
Dropbox Staff

@DeeG2009 A 'path/conflict/file' error indicates that the upload failed because there is already a file at the specified path. If you did want it to overwrite an existing file at the specified path, you can set the write mode accordingly, like in the example that Ð—дравко linked to earlier. Otherwise, yes, you would need to use a unique name. Exactly what filenames you use and the logic you use in your code is up to you.

Здравко
Legendary | Level 20

@DeeG2009 wrote:

..., ive been messing with this for almost a week now, and thats all it was. "/CPGC/Akron/" is working just fine to the existing folder. ...


As Greg correctly supposed and you skipped to say, you are running team account, not personal. Your initial path is correct and would work for personal account. By default upload path starts from your home folder; for personal account home folder and account root is the same thing, but for team account it's not (and that's where your issue comes from).

 


@DeeG2009 wrote:

...

I am assuming it is because when my script runs it will name the images, example: image1.jpg,image2.jpg, etc... and once stopped and started again it starts at 1 again and will not overwrite, Could a timestamp always keep the naming unique ?

...


If you want to overwrite, you have to specify it explicitly. Auto-rename should be specified if desirable too.

 


@DeeG2009 wrote:

...

My ultimate goal is to be able to have the script run down a list of lines in a csv instead of just one line, each line in the csv would be for different folders and corresponding data for each image to be uploaded to, but i cant figure out how to have the script run each line in the csv say 10 times, then move on to the next and so on... 


As far as I can see, you want to append line(s) to a csv file. Unfortunately, Dropbox doesn't provide such a feature. You have to upload entire file. 🤷 That's it.

DeeG2009
Explorer | Level 3

"As far as I can see, you want to append line(s) to a csv file. Unfortunately, Dropbox doesn't provide such a feature. You have to upload entire file. 🤷 That's it."

 

so i cannot have 50 lines in the csv file to upload to 50 different folders 1 by one, or 10 by 10, etc...? that seems like it is up to the code not drop box. if it can upload to one dropbox folder, it should be able to read a list of destinations right?

Здравко
Legendary | Level 20

That what I said is you can't append to a file, nothing more. You can have whatever you want wherever you want. Just every next version should be uploaded anew.

DeeG2009
Explorer | Level 3

I apologize, i am just not understanding what it is you are trying to say. You have to act like you are talking to a child with me haha. 

Greg-DB
Dropbox Staff

@DeeG2009 Ð—дравко was pointing out that the Dropbox API does not offer functionality for just appending additional data to an existing file on Dropbox. For example, if there's an existing files uploaded on Dropbox that is 5 bytes long, there isn't a way for your app to upload just an additional 1 byte to make the resulting file 6 bytes long. You would need to upload the whole 6 bytes.

 

It's not clear to me if you necessarily need such a feature but regardless you of course control the execution flow of the logic in your code. You can write logic to issue 1 or 10 or however many calls to the Dropbox API as/when you need, in whatever order.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    DeeG2009 Explorer | Level 3
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?