synchronizing/backup folders

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

synchronizing/backup folders

#1 Post by Ed Dyreen » 31 Jan 2016 12:46

I have the following setup:

external ed-serv-2 NAS share ed-serv-0 ( contains ed-serv-1\ed-serv-0\ )
external ed-serv-1 NAS share ed-serv-0 ( contains ed-serv-0\ed-serv-0\ )
external ed-serv-0 NAS share ed-serv-0

AND

external ed-xtra-2 NAS share ed-xtra-0 ( contains ed-xtra-1\ed-xtra-0\ )
external ed-xtra-1 NAS share ed-xtra-0 ( contains ed-server-0\ed-xtra-0\, ed-server-1\ed-xtra-0\ )
internal ed-server-0 PC share ed-xtra-0
internal ed-server-1 PC share ed-xtra-0

When I want to backup my ed-serv files I delete all the folders on ed-serv-2.
Then I move all folders on ed-serv-1 to ed-serv-2.
And then copy all files on ed-serv-0 to ed-serv-1.

When I want to backup my ed-xtra files I delete all the folders on ed-xtra-2.
Then I move all folders on ed-xtra-1 to ed-xtra-2.
And then copy all files on ed-server-1\ed-xtra-0 and ed-server-0\ed-xtra-0 to ed-xtra-1.
So ed-xtra-1 contains the ed-xtra folders from 2 different systems.

I would like to automate this process, and use synchronization.
Windows offers some options like offline file synchronization and the briefcase.
But these technologies are for synchronizing offline files.

I cannot use windows backup because the files need to be accessible and not in a *.backup archive.
When for example serv-0 is down, the backup share on serv-1 needs to be used.

I am looking for some tool, preferably with a command line programmable interface that can be programmed to do a synchronization in such way that it does an intelligent clone ( unchanged files are untouched ). And has the same effect as described above.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: synchronizing/backup folders

#2 Post by aGerman » 31 Jan 2016 17:08

Sounds like mirroring which means
- copy new files
- overwrite changed files
- leave unchanged files untouched
- delete files that still exist in the backup but don't exist in the source anymore

ROBOCOPY has the option /MIR for this purpose.

Regards
aGerman

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: synchronizing/backup folders

#3 Post by Ed Dyreen » 31 Jan 2016 17:20

I forgot to mention the process should abort immediately if it turns out a file is locked. Will robocopy try to complete ignoring errors or can I tell it to abort the entire operation if a source or target turns out to be in use by another program ?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: synchronizing/backup folders

#4 Post by aGerman » 31 Jan 2016 18:05

ROBOCOPY doesn't abort if an error occurs. There are two useful options though.

/r:N where N is the number of retries on failed copies. Default is 1,000,000.
/w:N where N is the wait time between the retries in seconds. Default is 30.

You can define and adjust either of them. And probably you should do so because otherwise the process would try 30,000,000 seconds long to copy a file ... :wink:

Regards
aGerman

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: synchronizing/backup folders

#5 Post by Ed Dyreen » 31 Jan 2016 18:17

So the entire process completes before errors can be handled ? damn :(

Post Reply