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

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

问题描述

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

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

文件/复制 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' 在文件夹上没有多大意义.复制的目的是创建与第一个具有相同媒体内容的第二个文件.由于文件夹没有媒体内容,复制"实际上并不适用.

'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.

要回答这个问题,我们需要稍微了解一下您的用例.以 *nix 范例为例,cp -R folder1 folder2"递归地复制所有文件.如果这是您的用例,您将需要手动递归树.如果您希望相同的文件出现在两个位置(即ln -s folder1 folder2"),则可以通过添加第二个父级来完成.

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天全站免登陆