[[!comment format=mdwn username="https://www.google.com/accounts/o8/id?id=AItOawmicVKRM8vJX4wPuAwlLEoS2cjmFXQkjkE" nickname="Thomas" subject="pseudocode" date="2013-12-08T15:23:36Z" content=""" The implementation should really be nothing more than the following to be run from a regular git annex repository with a configures special plain directory remote: foreach(path : allAnnexedFiles) { if(remote.exists(path) && remote.filesize(path) === expectedFilesize) goto finally; if(fileAvailableLocally(path)) { copyFileToRemote(path); goto finally; } if(shouldCopyFromElsewhere && canCopyFileFromSomeOtherRemote(path)) { copyFileFromSomeOtherRemoteToRemote(path); } finally: logThatFileExistsOnRemote(path); } foreach(remotePath : filesInRemoteDir) { if(fileIsAnnexed(remotePath) || fileIsIgnored(remotePath) continue; delete(remotePath); } The above pseude code assumes - that the no other process is working on the remote at the same time. - that the remote is not trusted. - that nobody expects changes done at the remote to propagate to other clones. """]]