Box api for multiple files download - box-api

I want to download multiple files in zip format from my BOX account by BOX API. Is it possible? Or should we download multiple file calling the api multiple times?

It's currently not possible to download a folder as a Zip through the Box API.
To download all the files in a folder, you would first have to get a list of the files in a folder by calling the Get Folder's Items endpoint. Then you would have to call the Download File endpoint for each of the files.

Related

Getting files from Google Drive "Computers" into Google Colab

I need to make use of Google Colab's GPUs, but also need to constantly upload new files and make slight adjustments to other files so I used Google's Backup/Sync tools to automatically stream a folder from my local machine into Google Drive so that new/updated/deleted files are automatically loaded. The problem is that I can't figure out how to get the data from the computer into Colab.
Most solutions I've seen on stack overflow use
from google.colab import drive
drive.mount("/content/gdrive",force_remount=True)
The problem with this is that upon doing this, inside of /content/gdrive there is only the folder "My Drive", whereas the files from my computer get saved in a different area "Computers/My Computer/". Thus these files aren't accessible using this method. Is there a way in Colab to be able to access the content in Computers/My Computer/ ?
The only other solutions I have seen have some code inside of Colab allowing you to directly upload files, which doesn't suit my purposes since I don't want to have to manually upload files every time.
In Colab, you might not be able to access any folder or files other than "/content/drive/My Drive". For example, you are not able to access files under '/content/drive/Computers/My Laptop/Project_R_Py/lib_py'.
You can simply go to google drive, right click that folder ("lib_py") and choose "Add Shortcut to Drive". After that you should be able to access that folder by specifying "/content/drive/My Drive/Project_R_Py/lib_py"
Hope this helps

Upload files to HTML form from Google Drive

I want to know if there is any way to implement so that users can upload files on my website from their Google Drive account. I need to collect users school assignments, and right now I need them to export their Google Documents to PDF and then upload them. This requires an extra step, and I wonder if you can put a button instead on my website that says something like "Upload file from Google Drive", and they can click on it and choose which document to upload.
Use https://developers.google.com/drive/v2/web/picker to allow the user to choose the file. The picker returns a file ID, which you can then use with the Drive SDK to fetch the contents and ulpoad to your own server.

Downloading files from Drive using alt=media with correct filename

I'm having trouble allowing files (non-shared) to be downloaded from a Google Drive account. I've created a listing using the php drive sdk and would like to provide authorised links to download the files using a generated access token. I've got downloads working with links like this:
https://www.googleapis.com/drive/v3/files/[fileid]?alt=media&access_token=[access_token]
The problem is that whenever a file is downloaded, it is named [fileid].[extension], rather than the real file name that appears in Drive.
I've tried adding the download="[real filename]" into the a link to suggest the correct filename, but it's being ignored in all the browsers I've tried.
I've got an alternative working that gets the file piece by piece server side and echoes it out as a file via php, but I'd prefer for downloads to be straight from Drive to the user.

chrome.fileSystem on files/folders inside the app/extension

I am working on a Chrome App where I need the users to open files in a directory. For his own files, I can offer them a dialog through
chrome.fileSystem.chooseEntry
which works well. However that seems to limit me to the "Downloads" directory and Google Drive on my Chromebook. I would also like to ship some files with the application itself, so the files/folders would be located inside the app package. Is it possible to access these files through the fileSystem API?
I would not need the user to choose the files from a dialogue, it would be enough if I could get a handle to these files and offer to display them on the click of a button through my app.
Thanks in advance
You can read included files using chrome.runtime.getPackageDirectoryEntry(function(directoryEntry) {})

How i can get multiple files from google drive through the google drive api?

I would like to know how i could to obtain multiple files from google drive. I searched this in the reference but i not found this information. I'm building a web application that will talk to drive and retreive a link of a zip file to download. Zip of the files.
I'm using php with api v2.
That is currently not possible with the Drive API, you have to send multiple requests to retrieve multiple files.
I've been faced with a similar problem and while there's currently no way of doing this through Drive (to my knowledge), this is the solution I came up with.
I'm serving up hundreds of thousands of files to clients using a Drive folder as the storage with a custom built front-end built with the Drive API. With that many files, it's ridiculously tedious for users to download files one at a time. So the idea was to let the users select which files they'd like to download and then present them with a zip file containing the files.
To do that, first you'll need to get an array of the Drive files that you want to download whether that's some you generate programmatically or through check-boxes on the front-end. Then you'll loop through that array and grab the 'downloadURL' value for each file and perform a cURL to the url provided. Depending on how many files you're planning on handling per request you can either keep them all in memory or temporarily store them on the disk or in a database. Regardless, once you have all of the files, you can then zip them up using any number of zip libs that are out there. Then just send the resulting zip file to the user.
In our case we ended up sticking with individual file downloads because of the potentially massive amount of resources and bandwidth this can eat but it's a potential solution if you're not serving large numbers of files.
Assuming I am answering the correct query, if you place the files in a folder on google drive, then as far as I know it is possible to download as a complete group of files.