Syncing NextCloud with OneDrive

There is no native way to synchronize NextCloud with OneDrive (now), I know. But is there an approved way to synchronize one NextCloud-Client-Folder with OneDrive? At a 24/7 online Ubuntu Server?

Why I want to do this: I want to use MS OneNote. At PCs I use the 2016 Version and save the files to my NC folder. But at my mobile (iPhone) OneNote only works with OneDrive. (But I don’t want to install OneDrive on my PC).

What’s the best way to handle this?

1 Like

maybe: https://rclone.org/onedrive/

1 Like

Thanks Reiner_Nippes. OneDrive works but I also need a NC-sync. But I only see a way to upload data to the Cloud, not to download or sync!? https://rclone.org/webdav/#nextcloud

What do you mean with NC folder?

I assumed that this is a folder at your PC that is synced to your Nextcloud server. There you would run a cronjob with rclone to sync the files to OneDrive.

Nextcloud folder.

This is a folder “inside my nextcloud”, at my Nextcloud Server. But I can’t simple access to it, I need a client to sync it. I can use the nextcloudcmd (Client) for this, bis this doesn’t work at all systems (RPi), so I thought I could also use for this rClone?

Do you have shell access to the nextcloud server?

yes, it’s my server, at my hardware.

… so that’ I’d like to say that (as you should know) you can’t just access the folders of the cloud. If you do, you have to scan the data again “occ files:scan”. That’s why it makes sense to synchronize a single folder with a client. Even if it is on the same device. Or?

Correct, you don’t really want to bypass Nextcloud’s database and get to files directly, where it can be avoided.

You might be interested in rclone mount, which will let you mount Nextcloud’s WebDAV share to a separate folder in your system. You can then safely make changes/sync, and it will keep the Nextcloud database up to date as it goes.
Note that this does not create duplicate files, it only makes a local mount point where existing files are accessible. There are performance draw-backs, perhaps worse than the default Linux WebDAV mount, but this way reportedly honors Nextcloud’s recorded modification dates.
You can then use rclone copy or rclone sync, as appropriate, from this newly mounted folder to OneDrive.

Depending on your workload though, it might actually be more performant to do the sync straight from Nextcloud’s internal data folder, and scan immediately after. If rclone reports on local files it’s changed (or if you can parse the logs), you can script to run the scan again only where that’s the case… and perhaps only on those individual files.

The way to download your data would be to run the same command you use to upload (rclone copy <source> <destination>, I assume?) in the reverse. A two-way sync would be one followed by the other. The down-side would be, if you remove or rename something on one side but not the other, you’ll have it right back as soon as the sync runs again.

The rclone sync command simply makes one side mirror the other, rather than intelligently and bi-directionally synchronizing their changes… but this thread on their forums points to a script for more robust 2-way sync, if that helps.

1 Like

what about: https://www.maketecheasier.com/sync-onedrive-linux/ and use the local onedrive folder with the external storage app on your server?

external storage app detects a change of files in the folder without occ files:scan

I have not found this to be the case, at least not in Nextcloud 14 with a local (ext4) external folder that was simultaneously served SAMBA. I still had to run a scan in order for changes to be reflected in Nextcloud at the time.
Has this changed, or was there something special you did to keep it up to date? I’d be glad to hear if this simply works now!

didn’t test it myself but there should be an option now. (check for changes)

https://decatec.de/home-server/nextcloud-direkter-zugriff-auf-dateien-ueber-das-dateisystem/ (sorry for the german link.)

1 Like

Thank you, that would be an other option … for other users. I still got the same bugs since 2017: Can't remove external mount
But in the future I will reinstall the complete server and maybe … maybe it will finally work with this function.

So are you running on a virtual machine infrastructure like Hyper-V or ESXi? I employed NextCloud in OpenMediaVault on Bug 10’s Hyper-V, and ran into the same problem. In the end I set up NFS server under OMV, mount NFS under Windows and set OneDrive folder synced with NFS. Though it would waste disk space, at least it works…

Besides, OneDrive is available as webdav service so you may consider use that. However, I am not sure about the performance…