Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
ThatBritishOne
4 years agoExplorer | Level 3
Bash Upload Script
Hello, I'm trying to create a script to for each over a folder, and upload to the API but I cannot figure out where I'm going wrong. This is the script I have so far, any help would be apprec...
Здравко
4 years agoLegendary | Level 20
Hi ThatBritishOne,
Seems you cannot understand the idea of different types of upload strategies. You can use a single call upload (seems most suitable for you) and using /2/files/upload you can upload all files, one by one. If some file is bigger than 150MB, then you have to use upload session. Upload session (/2/files/upload_session/start) is NOT for upload multiple files, but upload one file in pieces, every one piece 150MB at most. Be careful here. 🙂 Seems you are mixing the idea here! Other option is upload multiple files in batch (/2/files/upload_session/start_batch) that let you finish multiple files at once and decrease chance for call conflicts (possible on high load - multiple applications try access/change the same account content simultaneously). Hope this gives direction at least. Something you might be source of mistake is your 'DROPBOX_API_KEY'. What this actually means???!!! The name suppose application key, but you are using it as an access token! Take care. Take in mind that access token need refresh and you didn't implement any handling with refresh token. 😉 You may consider such option.
Good luck.
- ThatBritishOne4 years agoExplorer | Level 3
Hello,
Thanks for the help, I managed to update the script so it for eaches over every file and uploads it.
The problem I'm having now is keeping the folder structure, as it uploads it as a file rather than creates a new folder each time.
Is there a way I can preserve the path to upload and create the folders automatically?
- Здравко4 years agoLegendary | Level 20
ThatBritishOne wrote:...
Is there a way I can preserve the path to upload and create the folders automatically?
The API creates folder structure automatically - no folder(s) containing file need creation explicitly (only empty folders, if any, need explicit creation). Check what 'path' have you set for each entry (need to match actual relative path and the Dropbox path format rule).
- Greg-DB4 years ago
Dropbox Community Moderator
ThatBritishOne Здравко is correct, you can control the folder hierarchy where you upload a file by using the "path" value. For example, if you want to upload a file named "newbackup" into a folder named "10-24-2022" which is inside a folder named "Backups", the "path" value should be "/Backups/10-24-2022/newbackup".
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!