1.

Solve : question on xcopy to perform incremental backup?

Answer» HI,

I was wondering if i could get some help here. I have data folder which contains all the emails messages my mail-server has received on a daily basis. What i'd like to do is to be able to back them up with xcopy i created in a batch file. However, i don't know how to back them up in an incremental fashion meaning that i want only what's been changed or NEW messages be backed up. I don't want to back up what's already been backed up as it would waste too much space in memory.

So, this is what i've come up with in a batch file

xcopy C:\Program Files\qmail\data C:\backup_emails /M/E/H

Just wanna check whether the above xcopy command will perform incremental backup for my email messages.

Thank you in advancelook here

http://www.icpug.org.uk/national/features/041107fe.htm
Thank you Contrex for your reply.

I tried it out but got stuck on SUBST x: c:\BLAH blah. What happens if my computer doesn't have virtual drive? Is it something i can create?

Thank you in advanceQuote
xcopy C:\Program Files\qmail\data C:\backup_emails /M/E/H

Just wanna check whether the above xcopy command will perform incremental backup for my email messages.

I wouldn't worry about all that

c:\>xcopy /?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+FILE2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.

[snip]

/M Copies only files with the archive attribute set,
turns off the archive attribute.

[snip]

/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.

[snip]

/H Copies hidden and system files also.

[snip]

The first time you run your batch, The /M switch ensures that Xcopy will copy everything that has the archive bit "set", (a bit which is "set" has a value of binary 1). After it has copied each file, it will "unset" (ie change to binary 0) the archive bit for that file.

The next and subsequent times that the batch is run, the /M switch ensures that Xcopy only copies those files which have arrived since the last run, again, marking them as copied.

Thus the incremental backup is achieved.

The /E switch makes Xcopy dig down into subfolders, and the /H switch makes it copy hidden and system files (if it finds any)

So, YES, that looks as if it will do what you want.



Discussion

No Comment Found