为本地文件夹选择性同步 Google Drive? [英] Selective sync Google Drive for local folders?

查看:49
本文介绍了为本地文件夹选择性同步 Google Drive?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Drive 中是否有一种方法可以对本地文件夹进行选择性同步,即让父文件夹同步到云端,同时仅将一些选定的子文件夹保留在本地?

Is there a way in Google Drive to make selective sync for local folders, i.e. having the parent folder synced to the cloud while keeping some selected sub-folders local only?

例如,在我的本地电脑中,project 文件夹有 3 个子文件夹:datasourcebin.有没有办法使用 Google Drive 备份 project 而忽略 bin?

For example, in my local pc the project folder has 3 sub folders: data, source, and bin. Is there a way to use Google Drive to back up project while ignoring bin?

推荐答案

我知道这是一个老问题,Google Drive"现在是Backup and Sync from Google",但它仍然适用.我花了一段时间才弄清楚这个解决方案,这样我就可以在不包括依赖项或缓存的情况下同步我的项目.

I know this is an old question and "Google Drive" is now "Backup and Sync from Google", however it still applies. It took me a while to figure out this solution so I could sync my projects without including dependencies or caches.

据我了解,问题是您想要同步一个文件夹,但是文件夹中有一些子文件夹或文件您不想同步,但希望保留在您的本地计算机上(不是 Google Drive).目前,Google Drive 只做相反的事情(它允许您在 Google Drive 上保留一份副本,但不能在您的本地计算机上).

As I understand it, the issue is that you want to sync a folder, however there are some sub folders or files within the folder you do not want to sync, but would like to keep on your local machine (not Google Drive). Right now, Google Drive only does the opposite (it will allow you to keep a copy on Google Drive, but not on your local machine).

解决此问题的一种方法是在要同步的文件夹中创建符号链接,Google Drive 将忽略它们(在 Windows 10 上使用 mklink 命令测试).

One way around this is to make symbolic links in the folder you want to sync and Google Drive will ignore them (tested on Windows 10 with the mklink command).

例如,假设这是您的文件结构...

For example, let's say this is your file structure...

C:
-- Google Drive
---- MainFolder
------ SubFolderA
------ SubFolderB
------ SubFolderC
------ FileA.ext
------ FileB.ext
------ FileC.ext

现在,假设您希望在本地计算机上使用 MainFolderSubFolderB 和 MainFolderFileB.ext,而不是 Google Drive.在 Google Drive 文件夹之外的某个地方创建一个MainFolder"(例如:C:MainFolder),然后将 SubFolderB 和 FileB.ext 移动到新创建的文件夹中.

Now, let's say that you want MainFolderSubFolderB and MainFolderFileB.ext on your local machine, but not Google Drive. Make a "MainFolder" somewhere outside of your Google Drive folder (eg: C:MainFolder), then move SubFolderB and FileB.ext to the newly created folder.

您的文件结构现在应该如下所示......

Your file structure should now look like....

C:
-- Google Drive
---- MainFolder
------ SubFolderA
------ SubFolderC
------ FileA.ext
------ FileC.ext
-- MainFolder
---- SubFolderB
---- FileB.ext

接下来,我们要创建符号链接.对于此示例,您将在管理员模式下运行命令提示符并运行以下命令:

Next, we'll want to create the symbolic links. For this example, you'd run the Command Prompt in Administrator mode and run the following commands:

mklink /D "C:Google DriveMainFolderSubFolderB" "C:MainFolderSubFolderB"
mklink "C:Google DriveMainFolderFileB.ext" "C:MainFolderFileB.ext"

现在您的文件结构将是:

Now your file structure will be:

C:
-- Google Drive
---- MainFolder
------ SubFolderA
------ SubFolderB (symbolic link to C:MainFolderSubFolderB)
------ SubFolderC
------ FileA.ext
------ FileB.ext (symbolic link to C:MainFolderFileB.ext)
------ FileC.ext
-- MainFolder
---- SubFolderB
---- FileB.ext

就是这样!您符号链接的文件夹/文件仍将位于您的本地计算机上,但不会存储/同步到您的远程 Google Drive.

And that's it! The folders/files you symbolic linked will still be on your local machine, however it will not be stored/sync'd to your remote Google Drive.

编辑

在此处发布实际答案而不是链接.

Posted the actual answer here instead of linking it.

这篇关于为本地文件夹选择性同步 Google Drive?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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