Backup batch scripting

Posted on 2008-02-11
Medium Priority
Last Modified: 2010-04-16
I am trying to create a batch file that will backup my documents folder when ran. I will have many files that didnt change however so I dont see the need to back these up and due to the size of some of them this will cause it to take a long time. I want to know if theres some way to check if the file has changed before it backs it up.

Heres what I have so far that backs everything up:

xcopy /i /y /e "Location on local pc*.*" "Server location"

This works great, but takes forever due to the amount of files. Any help would be greatly appreciated.
Question by:omnova
LVL 18

Expert Comment

by:Andrej Pirman
ID: 20870065
This one copies only files, whose change date is newer than destination:
xcopy /d /i /y /e "Location on local pc*.*" "Server location"

And this one works with Archive attribute, copying only those files, which have Archive bit set:
xcopy /m /i /y /e "Location on local pc*.*" "Server location"

LVL 33

Expert Comment

ID: 20870076
try this:

  xcopy /i /y /e /d "Location on local pc*.*" "Server location"

per xcopy /?

  /D:m-d-y     Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
LVL 14

Accepted Solution

canali earned 2000 total points
ID: 20915908
I think robocopy should be the best solution fast, robust and "intelligent" (copy only file changed...)

robocopy "c:\my dir" "\\server\my share" /w:1 /r:1 /s /z
/Z : Copy files in restartable mode
/R:n : number of Retries
/W:n : Wait time between retries second
/S : Copy Subfolders


Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Dropbox has a relatively new feature called Smart Sync.  This feature allows Dropbox Professional (not plus) and Dropbox Business (if enabled) users to store information in Dropbox WITHOUT storing any files on their computer.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question