xcopy is illogical?

Solution 1:

Robocopy has far more options and is built in on most recent Windows versions.

robocopy source-dir destination-dir filespec /E /XC /XN /XO 

This will only copy across files that meet filespec (e.g. *.avhd in your example) from source dir (c:\Hyper-V\vhd in your example) to destdir (z:\backup\hyperv_vms). The switches tell it to skip older, newer and changed files so it will only copy across files that exist in the source directory that do not exist in the destination already.

Solution 2:

I use xcopy /d /e /c /k /y /v /o which provides no prompting and doesn't overwrite existing files if the source is the same date as the destination.

Solution 3:

The /M parameter tells it to copy only files with the "Archive" attribute set, and resets that attribute at the same time.

The "archive" bit is a part of the file system, like the "Read Only" bit or the "System file" bit. It was traditionally used for old-fashioned "naive" backup software so that it could tell whether or not a file had been changed since it had been archived last. The OS should switch on the archive bit any time a file is changed (or set it on newly created files) and the backup software then backs up the file and switches the bit off to show that it has been archived now.

You can see whether or not this is set on your files by changing to the folder in a command prompt and running attrib any files with an "A" in the first column are waiting to be archived.

Solution 4:

I would use rsync for this purpose. You can download a Windows-compatible binary or get it as part of Cygwin (I recommend the former approach unless you already have Cygwin installed). You can either push files to the remote site or pull from it. I prefer the pull method, but either will do.

Using the pull method, the rsync daemon will run on the source server; using push, the rsync daemon will run on the destination server. Here's an example of a pull daemon config file:

max connections = 4
port           = 873
read only      = true
write only     = false
auth users     = syncman
secrets file   = /etc/rsyncd.secrets
strict modes   = false
hosts allow    = 192.168.1.8
refuse options = delete

[ProjectOne]
comment = Jimmy's Project
path    = C:/projects/project_one

[MutualProject]
comment = The MUTUAL project
path    = C:/paid_projects/mutual

How you specify the path will depend on which rsync port you use (e.g. cygwin specifies paths like this: /cygdrive/c/projects/project_one). You would then issue this command from the server:

rsync -a -v 192.168.1.15:ProjectOne backups/ProjectOne

(where the IP address is the source machine's IP address). If the backup server is a Windows box, you would need one of the many cron-for-windows implementations.