Each folder selected for synchronization has a hidden .sync/Archive directory inside. This directory stores old versions of updated or deleted files: if a remote agent updates a file, other agents move their local copies to Archive. Archive can be a good source to restore unintentionally deleted files or their previous version.
Archive's behavior is configured in Profile with three options:
- Max archive file size (MB): the max size of a file that will be moved to Archive. Increase it if you work with big files. Note that this will require much storage space to keep the files' versions.
- Max archive file age (days): number of days a file remains in Archive until automatically removed for good. The longer it's kept, the longer it takes storage space. Decreasing this value makes sense on limited storages. You can manually clear Archive every now and then so as not to wait for automatic deletion.
Archive on mobile devices works the same way but has the following peculiarities:
- files are kept there for 1 day only and this cannot be changed.
- on iOS devices Archive cannot be opened by a person as its hidden inside Agent app's sandbox.
Archive also plays its role in processing file rename. From system's point of view renaming is deleting old_filename and creating new_filename. Hash of the file remains the same. When a remote agent renames a file, other agents can process it through Archive: move old_filename to Archive (ones it's deleted on remote agent) and instead of re-downloading the new_filename, take it out from the Archive. It saves time and network bandwidth.
Archive in Synchronization job.
Agent understands that a file is updated if notices that its 'modified time' and/or size have changed. Agent receives system notifications about file update. If a notification fails for a reason, agent discovers new file when rescanning the folder, which is performed periodically every 10 minutes by default.
Agent will recheck the file and, if it has read-write permission in the job, will upload the new version to other agents. Others will move their current file to their Archive folder and download the updated file. The agent where file was locally updated does not store the older file's version!
Same works for deletion: if an agent deletes file to its recycle bin (or skips it), others move the file from syncing folder to their Archive. Agent will consider a file to be deleted if file is not located in its place. Deleted file will not be moved to Archive on the agent who initially got it deleted off its file system!
Restoring files from Archive
When placed there, file gets the current "created" timestamp, but the "modified" timestamp is preserved. If Archive already has a file with same name there, new one gets (i) index, increments by 1. These markers can help identify the wanted file in case you need to restore one of the older versions. Resilio Connect does not support automatic restoring of files, this can be done only manually though a file manager - just move or copy the file out of Archive to its place in sync folder. Remove the (i) index or rename the file as you need.
An agent must be online when you take a file out of Archive. The thing it that this file will have the "modified" timestamp older than that on other agents. If Agent runs , it can detect the file change and upload it to others. If it does not run, it will detect the restored file only when rescanning the folder, will compare "modified" timestamp with that from other agents and again move it to Archive as being older.