Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: 2 computers, both backing up their local data to the other - Trash Data Cleanup  (Read 3170 times)

0 Members and 1 Guest are viewing this topic.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
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.  :-\

Lisa_maree



    Mentor
  • My first real computer
  • Thanked: 161
    • Yes
  • Experience: Expert
  • OS: Windows 10
Hi Dave

Have you seen Unstoppable copier , it has a batch mode which covers most of your requirements.

Quote from site:

The program can be used as a daily backup system using its batch mode functions. A list of transfers can be saved to a file and then run from the command line to perform the same batch of transfers on a regular basis without having to use the GUI interface. The program supports command line parameters which allow the application to be run from schedulers or scripts so it can be fully integrated into daily server tasks.

I setup users with an icon called mystuff when they click on the icon it backups all there user profile.

 http://www.roadkil.net/program.php?ProgramID=29

You have not lived today until you have done something for someone who can never repay you.”
― John Bunyan

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
robocopy with the /MIR  switch sounds like what would be desired. it will copy everything from source to destination but will also delete files or directories that exist in the target location but are not present in the source folder.

You may be able to just do a drop in replacement of your xcopy command in the batch file(s) with robocopy using the /MIR switch.
I was trying to dereference Null Pointers before it was cool.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Cool ... Thank You both for your help with this.

Going to check out the unstoppable copier. Never heard of it before and it sounds pretty cool.

BC's solution looks like the easiest and best to implement for this issue with cleanup. I wasn't aware of robocopy's /MIR switch. Very Cool!

Thanks for the help with this.  8)