How to synchronize directories outside the Google Drive directory
Solution 1
You could use what I used when I had the same issue with Dropbox. And that's to use: NTFS Junction Points like you said.
It's pretty much a worm hole in the file system that makes a shortcut without appearing like one to applications. There are downsides to using these as an antivirus would scan both folders (despite physically being the same), amongst other things.
Try something like Junction Link Magic instead of command lines if it helps.
Update: it appears JLM does not create junction points the way we wanted. Instead use Junction Master which creates hard links, and that will lie to applications the way we need it to. You can read more here.
Creating a link in Junction Master will allow Google Drive to see it in the options.
If we look at it in terms of shortcuts, consider a Junction Link as the shortcut file, and Destination as the original location.
And consider looking at tutorials to do this for Dropbox, as Google Drive similarly has only a single sync folder.
Oh and I'd avoid juntion points between drives!
Solution 2
I have significant experience with Junction Points and Symlinks and note the following results:
Junctions & SymLinks inside the Google Drive directory did NOT sync
Hardlinks offered no direct solution
Moving the actual directory to the Google Drive and creating the Junction from the ORIGINAL location TO the NEW (Google Drive) location DID sync (probably this would work for SymLinks as well)
Also: I haven't seen a problem with having junctions cross (LOCAL) drive boundaries (C: -> F:) and have done this extensively over the years). SymLinks are required to cross MACHINE boundaries (C: -> NetworkShare).
It's a PITA to move the directory and then link (and feels 'unnatural') but it works fine that way.
Solution 3
You could drag the actual folder to the Google Drive folder. Then create a shortcut to it where you originally had the folder.
Solution 4
From the Command Prompt:
mklink /J "C:\Users\<username>\Google Drive\<folder>" C:\path\to\folder
Solution 5
using the /d parameter with mklink on windows worked very well for me
cd %userprofile%\Google Drive
mklink /d Documents %userprofile%\Documents
Related videos on Youtube
Darqer
Updated on September 18, 2022Comments
-
Darqer almost 2 years
I installed Google Drive and want to use it in order to backup some data scattered across my HDD.
I cannot get it to use these different directories because I can set only one folder in Google apps. I tried to create junctions and hard links to the outer directories, however it does not work ... any ideas how to correctly set it?
-
Jay Wick about 12 yearsdo you see the hardlinked folders in the options?
-
Darqer about 12 yearsI cannot see them
-
TechnicalChaos almost 12 years@jay - Those aren't hardlinked folders. Those are just subfolders under the Google Drive directory.
-
-
Darqer about 12 yearsI tried and GoogleDrive application does not recognize it
-
Jay Wick about 12 yearsDid you only try Junction Link Magic? Maybe try Junction Master? Strange, I'll have to go home and try this myself.
-
Darqer about 12 yearsApplication can recognize junctions so I think that google does not synchronize with it.
-
Jay Wick about 12 years@Darqer: just tried JLM and confirmed it doesn't work. Tested Junction Master and it works fine with Gdrive. Updated answer
-
TechnicalChaos almost 12 years@jay - It just occurred to me that the actual files are residing in the Google Drive directory - you move them there from their original location - and then create a hard link (using junctionmaster or otherwise) in the original location to point to the directory under the Google Drive. I thought it was the other way around which is why I couldn't get it working. Any idea why putting the hard link inside the Google Drive which points to the directory in it's original location?
-
Jay Wick almost 12 years@Howiecamp: that's right, it's a matter of direction. As we found out above Google Drive refuses to show hardlinks, Windows Explorer is fine either way. It looks to only work when Gdrive has access to the real folder.
-
ᄂ ᄀ over 9 years/J switch creates a directory junction, not a hard link
-
DavidPostill almost 9 yearsOther answers have said that this doesn't work. Can you please explain why you think it does?
-
Danny Fanta almost 9 yearsIt worked for me, and none of the other information in the other answer that mentioned this was useful. Maybe Google Drive has changed in recent times, but I had no issues whatsoever with this single command.
-
ctbrown almost 9 yearsThis worked for me; It may take a while to get around to syncing your files so be patient before giving up.
-
Redoman about 8 yearsThe problem with this approach is that it will only work at the link creation time. At that moment, all the files inside the linked folder will be synchronized to the online folder, but if later on you go into that folder and add a file in it, it won't be synchronized to the online forlder. However, if you make changes to the online folder, they will be reflected on the local folder too. So basically it's only synchronized at creation time and then it's only one way.
-
Redoman about 8 yearsThe problem with this approach is that it will only work at the link creation time. At that moment, all the files inside the linked folder will be synchronized to the online folder, but if later on you go into the local folder and add a file in it, it won't be synchronized to the online folder. However, if you make changes to the online folder, they will be reflected to the local folder too anytime. I could also observe that when you try to add files to the local folder after making the link, they will keep the "refreshing" icon forever. Can anyone confirm this?
-
davejal about 8 years@jj_ I will check this. I just tried it and had some problems. I created a link, but noticed I made a mistake with the location, providing an incorrect location. I had to delete and try this command multiple times after that before it actually started to work. Now I will check to see if it will actually sync when changing a file.
-
Redoman about 8 years@davejal so how did it go?
-
davejal about 8 years@jj_ At this point it seems to have synced the file correctly (even using a totally other device to edit the file). I will do one more test tomorrow and see how that goes.
-
Redoman about 8 years@davejal My comment was not about "changing a file" though, but about adding or removing a file to the local folder (either by adding a file from the actual local folder, or by adding it to the link folder inside Google Drive folder)! Try doing that when you can please. Thanks.
-
davejal about 8 years@jj_ ooh, sorry, really misunderstood you. I will check when I get home tonight.
-
davejal about 8 yearsWhen updating in de original folder it doesn't update the web folder, but because the link is symbolic it does update the symbolic file.even updating in the symbolic file now doesn't update the google drive web file.
-
user3325403 almost 8 yearsJust tested junctions inside the GDrive folder. Works on windows 10 x64.
-
Redoman over 7 years@davejal so - in order for others to understand clearly - can you confirm this approach is subject to the issues I listed in my first comment to this answer?
-
davejal over 7 years@jj_ yes, that is the problem with this approach.
-
ᄂ ᄀ over 7 years@RefaelAckermann How did you tested it specifically? Windows 10 and Google Drive in hand, junctions are not recognized by Drive.
-
ᄂ ᄀ over 7 years1. There is no such thing as hard links to directories — MSDN. It is unclear what do you mean by this. 2. There is absolutely no need in tools like Junction Master. It does not somehow make links to folders work. What it does is create a new folder under Google Drive, move all content there and create a junction in place of the original folder. There is no magic here. The same can be done using the standard
mklink
. -
ᄂ ᄀ over 7 yearsTo those talking about "folder hard links" — superuser.com/a/269347/94068
-
ᄂ ᄀ over 7 yearsDo you claim that Google Drive has recognized the created junction and started to synchronize the contents of a folder it is linked to?
-
Avatar almost 7 yearsNot a solution if you cannot move the folder resp. change its path. For instance, as a developer you want to sync only certain folders from your xampp's htdocs folder. By moving the folders the sites cannot run locally anymore.
-
JinSnow over 6 years@RefaelAckermann could you please tell us how did you do that?
-
user3325403 over 6 years@JinSnow FWIW I used the CLI command mention in other comments
mklink /J "X:\<Google Drive>\<Link Name>" X:\path\to\folder
Maybe it depends on GDrive version... Also both link and target were on same drive. Anyway new "Google Backup and Sync" has this capability built in. -
Hakanai over 6 yearsHmm, I'm using Backup & Sync and finding that it isn't following junctions.
-
Sky about 5 yearsHow can I sync them in another device?
-
ihightower over 2 years@RefaelAckermann this didn't sync for me. junction is created. but google drive doesn't sync the junction.
-
HerbM over 2 years@RefaelAckermann the answer was 8 years ago, primarily on 2008-R2, and last update was 4 years ago. I haven't checked but it would not surprise me if a) something has changed or b) since this is very tedious to get right you might still have something not quite perfect. I originally had trouble getting it to work and sought this answer, then provided what I knew when no one else had a complete and elegant solution. (So I don't know :) )
-
Qwerty over 2 yearsWhat is the program doing differently than writing this in console
mklink /J linked_name original_folder
? -
Qwerty over 2 yearsYou could move the folder to gdrive and symlink/hardlink it back to the original destination then :)