在Google Drive SDK中,您如何复制文件夹? [英] In Google Drive SDK how do you copy a folder?

查看:1051
本文介绍了在Google Drive SDK中,您如何复制文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很简单的问题。如何使用Google Drive API复制文件夹?



看起来文件/复制API端点不适用于文件夹(尽管文档中未明确指出此限制)。



当然,我可以在文件中添加第二个父文件,但显然这不是一个解决方案,因为大部分时间文件夹副本都是在不修改原始文件的情况下完成的。



那我该怎么做?任何想法?

解决方案

'copy'在文件夹上没有多大意义。复制的目的是创建与第一个文件具有相同媒体内容的第二个文件。由于文件夹中没有媒体内容,因此复制并不适用。



要回答这个问题,我们需要了解一下你的用例。采取* nix范例,cp -R folder1 folder2递归复制所有文件。如果这是你的用例,你需要手动递归树。如果你想让相同的文件出现在两个地方(即ln -s folder1 folder2),那么通过添加第二个父文件来完成。


Very simple question. How can I copy a folder with the Google Drive API?

It looks like the file/copy API endpoint doesn't work with folders (though this limitation is not clearly indicated in the documentation).

Of course I could add a second parent to the file, but obviously that's not a solution as most of the time a folder copy is done to do something with it without modifying the original.

So how can I do that? Any idea?

解决方案

'copy' wouldn't make much sense on a folder. The purpose of copy is to create a second file with the same media content as the first. Since a folder has no media content, 'copy' doesn't really apply.

To answer the question, we need to understand your use case a little. Take a *nix paradigm, "cp -R folder1 folder2" is recursively duplicating all of the files. If that is your use case, you'll need to manually recurse down the tree. If you want the same files to appear in two places, (ie. "ln -s folder1 folder2") then that is done by adding a second parent.

这篇关于在Google Drive SDK中,您如何复制文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆