I wanted to find out if it is possible to link my htdocs folder (which is not located in oneDrive) to oneDrive so that it will be synced without necessarily moving the folder to oneDrive. It will kind of like a copy mirroring the original htdocs folder. Changes made in the original folder will be updated in the second folder.
24 Answers
You can use the following command to do so, linking Pictures to new_folder, and OneDrive will start to sync the contents of Pictures:
Mklink /j "%UserProfile%\OneDrive\Documents\new_folder" "H:\Documents\Pictures" 4 Don't know if you have checked my solution to this issue yet, but I believe would worth your time, it is open source and free here:
Essentially it is an app that provides you a nice GUI based symbolic link creation and periodically "bully"/trick OneDrive to scan and sync changes in all symlinked folders by renaming an empty file in the root folder of OneDrive.
Thanks,
1Same solution using modern Windows command line:
Open "Windows PowerShell":
New-Item -ItemType Junction -Path "$env:OneDrive\Documents\new_folder" -Target "H:\Documents\Pictures"Explanation: This creates a new folder link or junction point, as Microsoft calls it, within your OneDrive folder. This link is like a pointer so the content of "H:\Documents\Pictures" can also be accessed like if it exist in OneDrive\Documents\new_folder.
1Finally got this method to work, however a step seems to have been omitted (or unclear). The "%UserProfile%" refers to the "%CompletePath%" to the UserProfile uncluding "%C:\Users(UserProfile)%"
1