Friend of mine has 2 computers and I gave him a batch file that saves a copy of his data from each computer onto a shared folder on the other system. All was going well with it until he started deleting data that was no longer needed and while the local data folder it was gone, the shared folder on the other computer kept all files and folders, and so it started making a build up of Trash Data within these folders.
He asked me if there was a easy way to fix this. Easiest would be to blow away all the data at the shared path and copy over a new copy of the data. However this would be inefficient as for files and folders that dont need to be removed would be removed and then have to transfer over again to the neighboring computer making for a lengthy update to the shared backup location located on the other computer.
I was wondering if anyone has any suggestions either in batch or vbs or maybe an already existing software product out there that might be better than his current batch to replicate a copy of the C:\Data folder onto the X:\Data mapped network share. I have basically right now an XCOPY /s/d/y/h performing an update to the neighboring system where System1 at C:\Data xcopies the data to X:\Data which is a shared folder on System2. And System2 has an xcopy from C:\Data to a shared folder mapped to X:\Data on System1. The folder that is shared is named XDATA so C:\Data is the local data for that system and C:\XData is a copy of the other computers data.
Thinking about this, I was thinking it might be able to be achieved in batch by performing a compare between C:\XData of System2 and C:\Data of System1 and when file not found at C:\Data of System1 then it gets appended to a list of files to remove from C:\XData of System2 as a clean up process. And other way around for the other computer. However this would be able to remove files that are no longer wanted BUT then you could still have orphan folders after the files are removed from them. So a process would need to also remove orphan folders.
So looking for assistance with this one as to how to best deal with this vs the easiest but not very efficient process of a monthly complete inefficient purge to blow the entire file/folder contents away and bring over a fresh copy as a trash data cleanup process.