![sync with onedrive sync client sync with onedrive sync client](https://www.anupams.net/wp-content/uploads/2018/03/OnlineOnlySynedContent-Featured-800x420.jpg)
If the identifier of its parent is different, it must be moved. If an identifier only exists in the cloud tree, it must be newly created if it only exists in the base tree, it must be removed in the cloud since the last synchronization. Even if its parent is renamed or moved, as long as the identifier of its parent remain unchanged, this node will move along with its parent. For each identifier, if the corresponding nodes are the same in the cloud tree and in the saved tree, it is considered as unchanged. Each node stores its name, checksum if applies, and the identifier of its parent. Although we call them "trees", they are actually lists of nodes sorted by their identifiers. The cloud tree is then compared with the saved tree. We need to merge them in a two-way manner. Then there are three trees, the cloud tree, the local tree and the saved tree. At the same time, the saved state of the tree at the last synchronization is also loaded.
![sync with onedrive sync client sync with onedrive sync client](https://www.xda-developers.com/files/2019/06/onedrive-logo.jpg)
Also, there will be no identifiers for new locally created files, so the locally constructed tree needs to assign a temporary identifier to each file, and maintain a mapping between the real identifiers and temporary identifiers. Originally extended attributes are used because it moves with the corresponding file, but the default file manager, Nautilus, copies all extended attributes when copying files. You can inspect the locally stored identifier to FILENAME by getfattr -n FILENAME. The locally tree is easily constructed with aforementioned information, and the identifier information can be read from the extended attributes of each file or directory. OneDrive provided us with a simple API to dump the whole tree on the cloud, recursively, with the identifier and name of each item, and additionally the checksum of each file ( Current implementation is different). This effectively reduces the complexity of our algorithm.įirstly, the filesystem tree hierarchy will be constructed on both sides. AlgorithmĪn essential background is that OneDrive, like almost every cloud storage providers, assigns an globally-unique identifier to every file or directory (folder), because this identifier is also linked to other metadata like whether this file is allowed to be viewed by anonymous visitors, and the list of metadata is subject to grow at any time. We will ask you for the permissions to access your OneDrive files (of course), and to "access your information at any time", which means you do not need to login and authorize every time you use it. An SQLite database will be created and used as a central place to save essential information from the first time you run it, like your login token or the state of the whole filesystem tree at the last synchronization. Onedrive -set-location ~/OneDrive # ConfigĬurrently this utility utilizes extended attributes to save file identifiers locally, and modern filesystems and distributions should have this feature enabled by default. # If you want to use the latest snapshot use the following line instead
#Sync with onedrive sync client install#
To try it out, simply type this into your terminal (supposing you are using GNU/Linux and ~/.local/bin is in your $PATH) pip install -user onedrive-sync-client # Install If it fails due to conflicts, for example, you renamed a file locally but assigned the same file with another filename on your phone, this utility will complain and fail before making any operations, ensuring your data to remain intact.
![sync with onedrive sync client sync with onedrive sync client](https://newsignature.com/wp-content/uploads/2015/06/One-Drive-For-Business-Roadmap.png)
Run it in a testing environment before you know what is going onīased on Microsoft Graph, written in Python, this utility will detect changes you made locally and changes happened in the cloud, and try to merge them on both sides. Although it is designed to fail as soon as possible when conflicts are detected in order to avoid data loss, it is not guaranteed that your data is absolutely safe. DISCLAIMER: This utility is in its early stage.