如何使用谷歌驱动器API移动文件和文件夹? [英] How to move files and folders using google drive API?
问题描述
我正在尝试使用Google驱动器API执行简单的任务,如
- 跨文件夹移动文件。
- 列表项目
移动文件夹。
据我所知,Google驱动器API不提供跨文件夹移动文件的方法。
可以指定文件的/ parent和/ children API父文件夹,但它不适用于文件夹。此外,与文件关联的父属性不会将其移动到该文件夹下。它只是将一个父属性与该文件关联起来(这对我的情况根本不是有用的)
移动FILE-A从FOLDER-1到FOLDER-2,您可以使用 https: //developers.google.com/drive/v2/reference/parents 删除FOLDER-1作为父母并添加FOLDER-2。
您可以使用更新后的父数组也可以对该文件进行修补。
I am trying to use Google drive API to carry out simple tasks like
- Moving files across folders.
- List item
Moving folders.
As far as I could find Google drive API does not provide a way to move files across folders.
With /parent and /children API parent folder of a file can be specified but it does not work for a folder. Moreover the parent attribute associated with a file does not move it under that folder. It just associates a parent attribute with the file(which is not at all useful for my case)
To move FILE-A from FOLDER-1 to FOLDER-2, you can use the delete and add calls at https://developers.google.com/drive/v2/reference/parents to remove FOLDER-1 as a parent and add FOLDER-2.
You can also do a Patch on the file with the updated parents array.
这篇关于如何使用谷歌驱动器API移动文件和文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!