Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selective sync Google Drive for local folders? [closed]

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?

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?

like image 404
tsnguyen Avatar asked Sep 19 '16 23:09

tsnguyen


2 Answers

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.

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

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

Now, let's say that you want MainFolder\SubFolderB\ and MainFolder\FileB.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 Drive\MainFolder\SubFolderB" "C:\MainFolder\SubFolderB"
mklink "C:\Google Drive\MainFolder\FileB.ext" "C:\MainFolder\FileB.ext"

Now your file structure will be:

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

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.

EDIT

Posted the actual answer here instead of linking it.

like image 87
AcidicChip Avatar answered Feb 15 '23 08:02

AcidicChip


If the folder you want to exclude is in Google Drive, then you can simply do the followinghow to exclude folder from google drive backup and sync

Steps:

  • Go to Preferences
  • On the left pane, click "Google Drive"
  • Click "Sync only these folders"
  • Start by selecting the highest level folder you can see. Once selected, the subfolders will show up and you can then narrow down your selection further.
like image 33
bob chen Avatar answered Feb 15 '23 09:02

bob chen