When doing a two-way sync of directorys add a option to specify a info-file where file size/time of files is stored.
If there is information stored in the file, handle the following cases:
- File exists on A and has same size/time as in the info-file, doesn't exist in B:
DELETE on A
- File exists on A and has different size/time as in the info-file, doesn't exist in B:
COPY from A to B
- File exists on A and B and has different size/time than in the info-file:
COPY newer file, overwrite older
Of course the same with A and B switched.
After every sync write the names/paths of all existing files and their size and time into the info-file.
This would allow to sync files both ways, while allowing users to delete files.
I would need this, because I have a Server at home and some space at a web hosting company.
While at home, I and my family members want to use the server at home to access the files, because it is fast on the internal network.
While away, this is slow (because the home connection has only 1,5Mbit/s upload), so it is better to access the webspace which has a 100Mbit/s shared connection.
I sync the files every 10min, so there are probably always only changes on one side.