Have a Question?
< All Topics
Print

How to Sync Any Folders to OneDrive

Steps on how to sync any folders to onedrive

Symbolic Link can be used to sync folders in local computer to OneDrive

Login to SharePoint Online with PowerShell

Sync New Folder from local computer to OneDrive

Create a new folder called TEST in OneDrive

$OneDrivePath= "C:\Users\kwyong\OneDrive - Aventis Technologies Sdn Bhd"
$Folder = "TEST"

$OneDrive=New-Item -ItemType Directory $OneDrive\$Folder

Create a Folder in C:\TEST and link it to OneDrive

$Drive = "C:\"
New-Item -ItemType Junction -Path $Drive+$Folder -Target $OneDrive

Create a file in C:\TEST, and it will sync to OneDrive automatically

how to sync any folders to onedrive

Sync Any Folders to OneDrive

Create a new folder called VSCode and migrate all existing contents from C:\VSCode to OneDrive using Robocopy.

$OneDrivePath= "C:\Users\kwyong\OneDrive - Aventis Technologies Sdn Bhd"
$Folder = "VSCode"

$OneDrive=New-Item -ItemType Directory $OneDrive\$Folder

#Copy all contents from existing folder to OneDrive 
Robocopy.exe C:\VSCode $OneDrive /e /zb /copyall  

Delete the C:\VSCode and recreate it with Symbolic link to OneDrive

Remove-Item C:\VSCode -Recurse
New-Item -ItemType Junction -Path C:\VSCode -Target $OneDrive

Reference Link

https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

Table of Contents
Scroll to Top