Friday, March 16, 2007

How to do Backups with xcopy

The DOS xcopy command is like the copy command, on crack. Here's how you can use it to do incremental backups (only copies new or changed files).

xcopy "D:\Andy's Files\*" "I:\BACKUP\Data\" /h /r /s /e /i /c /y /d

Where "D:\Andy's Files\*" is the directory to back up and "I:\BACKUP\Data\" is the directory to back up to. /h copies hidden files, /r overrides read-only files, /s /e copies subdirectories including empty ones, /i assumes the destination to be a directory, /c continues even if errors occur, /y doesn't warn on overiding files, and /d copies only files that are newer than the destination file.

No comments: