Incremental backing up with XCOPY

A

Anthony Buckland

I've been working on a supplementary form of backup (other than
my more-or-less regular backups with Acronis True Image of my
entire C: partition). The volatile part of my file system is My
Documents, into which I've incorporated my Outlook Express
storage files and my Address Book. So I've backed this up by
straight copying to a thumb drive, which is a very compact and
durable way IMHO to carry around a fire/theft backup, and safe
since it's password-protected.

Now to the incremental part. The technique I've just tried for the
first time is to plug in the thumb drive (J:), go to command mode,
in C: go to My Documents, in J: go to the corresponding
directory, then in C: enter

XCOPY *.* J: /D /E /C /Q /H /R /Y /K

Benefits: fast as h___, three and a half minutes to deal with just
over 8 Gby; and doesn't bother me with "do you really want to
change this file?". (Today's test found 41 files to copy out of
5698.) Further benefit, thumb drive is available to show friends
things, demonstrate, share, load things from them, all without
presence of Acronis.

Drawback, possibly, doesn't ask me "do you really want to
change this file?". Further drawback, have to enter the commands
correctly -- I need to get this into a batch file.

I don't imagine I'm the first to hit on this technique -- any
comments or cautions?

------------------------------------------------------------------

A postscript: incremental backups save changes and copy new
data, but AFAIK they don't copy to the backup the absence of
data that have been deleted. If you back up incrementally
enough times, you're slowly going to accumulate a collection
of things in the backup that shouldn't be there yet would be
restored if you use the original backup and all its increments
to restore a system. Does any backup software cure this
problem?
 
B

Bob Harris

I have been using the XCOPY command in a batch file for years to backup
personal files.

Open NOTEPAD and type the variation of the XCOPY command you like. You may
add any number of lines beginning with "REM", without the quotes, as
comments. Save, exit NOTEPAD, then rename with extension "BAT".
Double-click on the BAT file to run it. Or, make a desktop short-cut, and
just press that button.

You might also want to use the /S option, to recursively copy
subdirectories.

And, there is an option /EXCLUDE:excludefile.txt, where "excludefile.txt" is
a simple text file that contains files and/or directories not to copy.
"excludefile.txt" is not a special name; it could just as well be called
"xxx.txt". The format of the exclude file is one line per file or
directory, such as:

\RECYCLED\
\SYSTEM VOLUME INFORMATION\
\TEMP\
*.BAK
 
P

Pegasus \(MVP\)

See below.

Anthony Buckland said:
I've been working on a supplementary form of backup (other than
my more-or-less regular backups with Acronis True Image of my
entire C: partition). The volatile part of my file system is My
Documents, into which I've incorporated my Outlook Express
storage files and my Address Book. So I've backed this up by
straight copying to a thumb drive, which is a very compact and
durable way IMHO to carry around a fire/theft backup, and safe
since it's password-protected.

Now to the incremental part. The technique I've just tried for the
first time is to plug in the thumb drive (J:), go to command mode,
in C: go to My Documents, in J: go to the corresponding
directory, then in C: enter

XCOPY *.* J: /D /E /C /Q /H /R /Y /K

Benefits: fast as h___, three and a half minutes to deal with just
over 8 Gby; and doesn't bother me with "do you really want to
change this file?". (Today's test found 41 files to copy out of
5698.) Further benefit, thumb drive is available to show friends
things, demonstrate, share, load things from them, all without
presence of Acronis.

Drawback, possibly, doesn't ask me "do you really want to
change this file?".
*** xcopy.exe does not produce any such message. What does
*** it really say?
*** If you're referring to the "replace" prompt - your "/Y" switch
*** takes care of it.
Further drawback, have to enter the commands
correctly -- I need to get this into a batch file.
*** OK, put it into a batch file and don't forget to specify both
*** the source and the target drive and folder!
@echo off
XCOPY "c:\My Documents\Anthony\*.*" J:\ /D /E /C /Q /H /R /Y /K

I don't imagine I'm the first to hit on this technique -- any
comments or cautions?

------------------------------------------------------------------

A postscript: incremental backups save changes and copy new
data, but AFAIK they don't copy to the backup the absence of
data that have been deleted. If you back up incrementally
enough times, you're slowly going to accumulate a collection
of things in the backup that shouldn't be there yet would be
restored if you use the original backup and all its increments
to restore a system. Does any backup software cure this
problem?

Use robocopy.exe. It has switches that will create a mirror of the source at
the target location. You can download it from here:
http://www.microsoft.com/downloads/...69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
 
A

Anthony Buckland

Pegasus (MVP) said:
See below.


*** xcopy.exe does not produce any such message. What does
*** it really say?
*** If you're referring to the "replace" prompt - your "/Y" switch
*** takes care of it.

*** OK, put it into a batch file and don't forget to specify both
*** the source and the target drive and folder!
@echo off
XCOPY "c:\My Documents\Anthony\*.*" J:\ /D /E /C /Q /H /R /Y /K



Use robocopy.exe. It has switches that will create a mirror of the source
at the target location. You can download it from here:
http://www.microsoft.com/downloads/...69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en

Right, I will indeed create a batch file.

Agreed, xcopy doesn't ask the kind of question I indicated. I was
contrasting
xcopy (with prompting off) with copy-and-paste, which does ask about
replacing
existing files in general, read-only files in particular, and system files
again in
particular.

Thanks for the pointer to robocopy. It looks as though it has an impressive
list of command line options. With Acronis I have hardly ever considered
an incremental backup, always making complete images.
 
A

Anthony Buckland

Bob Harris said:
I have been using the XCOPY command in a batch file for years to backup
personal files.

Open NOTEPAD and type the variation of the XCOPY command you like. You
may add any number of lines beginning with "REM", without the quotes, as
comments. Save, exit NOTEPAD, then rename with extension "BAT".
Double-click on the BAT file to run it. Or, make a desktop short-cut, and
just press that button.

Right, I intend to, but wanted to see any negative feedback first.
I've written various batch files, and fiddled with others. I go back to
the days when fiddling with AUTOEXEC (and CONFIG.SYS) was a routine
thing to have to do. For some reason, though, I'd never got into XCOPY
much before.
You might also want to use the /S option, to recursively copy
subdirectories.

I figured /E would be a better choice, since it copies empty
directories also. The help file indicates /E is equivalent to /S /E.
Why copy empty directories? Because their emptiness might
be only a temporary circumstance, and maybe there's a piece
of software that expects some of them to be there, but doesn't
have the smarts to create them.
And, there is an option /EXCLUDE:excludefile.txt, where "excludefile.txt"
is a simple text file that contains files and/or directories not to copy.
"excludefile.txt" is not a special name; it could just as well be called
"xxx.txt". The format of the exclude file is one line per file or
directory, such as:

\RECYCLED\
\SYSTEM VOLUME INFORMATION\
\TEMP\
*.BAK

Understood. I omitted it since it was My Documents I was copying,
and I can't offhand think of any directories in there that might not in
principle at least have an update to copy.

Thanks for the fast and helpful response.
 
T

Twayne

I've been working on a supplementary form of backup (other than
my more-or-less regular backups with Acronis True Image of my
entire C: partition). The volatile part of my file system is My
Documents, into which I've incorporated my Outlook Express
storage files and my Address Book. So I've backed this up by
straight copying to a thumb drive, which is a very compact and
durable way IMHO to carry around a fire/theft backup, and safe
since it's password-protected.

Now to the incremental part. The technique I've just tried for the
first time is to plug in the thumb drive (J:), go to command mode,
in C: go to My Documents, in J: go to the corresponding
directory, then in C: enter

XCOPY *.* J: /D /E /C /Q /H /R /Y /K

Benefits: fast as h___, three and a half minutes to deal with just
over 8 Gby; and doesn't bother me with "do you really want to
change this file?". (Today's test found 41 files to copy out of
5698.) Further benefit, thumb drive is available to show friends
things, demonstrate, share, load things from them, all without
presence of Acronis.

Drawback, possibly, doesn't ask me "do you really want to
change this file?". Further drawback, have to enter the commands
correctly -- I need to get this into a batch file.

I don't imagine I'm the first to hit on this technique -- any
comments or cautions?

------------------------------------------------------------------

A postscript: incremental backups save changes and copy new
data, but AFAIK they don't copy to the backup the absence of
data that have been deleted. If you back up incrementally
enough times, you're slowly going to accumulate a collection
of things in the backup that shouldn't be there yet would be
restored if you use the original backup and all its increments
to restore a system. Does any backup software cure this
problem?

Nope, that's a decent methodology and works well for many. Too bad it
can't handle system files too<g>, but ...

Xcopy bases what it will copy (or not) on the status of the Archive bit
on a file. On, copy; off, skip. So it works pretty well for
incremental backups.

If you're up to the task, there's an even more powerful extended version
of xcopy called XXCopy (found ta xxcopy.com logically enough), it's
free, uses all the same syntax xcopy has and then goes on to add a
kajillion other valuable and useful features such as progress bars and
many other things xcopy is missing. It's list of switches is incredibly
long though; you don't memorize them, you just research them and write
your batches accordingly<g>. Oh, it's free or pay and the pay version
is cheap at that. Great documentation too.
I use it instead of xcopy for my "lotsa changes" & "incredibly
important" backups rather than waiting for my imaging program to process
them; it's sort of a versioning system for me on top of backup. Every
file gets the date/time prepended to it for that purpose. That way
they're always handy on a disk: The batch file now even calculates the
size of the backups and alerts me when it's time to burn them to a DVD
and start re-collecting them.

Either program, a batch file is definitely the way to execute them.
Then make an icon for it and just trigger it from windows desktop when
you need to.

Personally I don't really see any drawbacks or cons to either program
if they fit the bill for what needs to be done. At first I had a
problem in that the backup would get too big for a cd, so I switched to
DVD, and then had to add the little alert to let me know the backup was
getting too big for a DVD. XXCopy made that easier, too. I'm looking
into a dual layer DVD right now so the saga continues<G>. On a good day
I'll run it up to a dozen or so times, depending.

HTH

Twayne
 
T

Twayne

Pegasus (MVP) said:
Right, I will indeed create a batch file.

Agreed, xcopy doesn't ask the kind of question I indicated. I was
contrasting
xcopy (with prompting off) with copy-and-paste, which does ask about
replacing
existing files in general, read-only files in particular, and system
files again in
particular.

One note: Neither xcopy, xxcopy, robocopy, etc., AFAIK are capable of
copying files that are IN USE, so be very careful using them to back up
anything system related. The imaging software does it by using the
Shadow Copy Services, but few other programs use that service.
I guess that's a downside; if you have the errors turned off and set
to just continue, you'll never know when it misses copying a file unless
you also create/examine the logs. Many system files are "in use" at all
times, others come and go depending on what you're doing, have been
doing, may do<g>.
So you should use error checking as opposed to just turning off the
messages to the screen and auto-continues. So, it's definitely NOT a
system disk backup system. Stick with your images for that.

HTH
 
A

Anthony Buckland

...
One note: Neither xcopy, xxcopy, robocopy, etc., AFAIK are capable of
copying files that are IN USE, so be very careful using them to back up
anything system related. The imaging software does it by using the Shadow
Copy Services, but few other programs use that service.
I guess that's a downside; if you have the errors turned off and set to
just continue, you'll never know when it misses copying a file unless you
also create/examine the logs. Many system files are "in use" at all
times, others come and go depending on what you're doing, have been doing,
may do<g>.
So you should use error checking as opposed to just turning off the
messages to the screen and auto-continues. So, it's definitely NOT a
system disk backup system. Stick with your images for that.
...

Thanks for that pointer. I'm using XCOPY only for My Documents,
and with nothing running except the usual collection of system
processes plus ZoneAlarm. I don't have automatic mail reception
turned on, so I wouldn't expect even my Inbox (as noted earlier,
I moved my Outlook Express store to My Documents, and in my
testing so far I've noticed that every recently changed OE file does
in fact get copied by XCOPY) to be in use. In the event that some
My Documents file failed to get copied, the worst that would happen
would be that a previous version would remain, unchanged, on the
thumb drive.

But I agree, XCOPY is a technique not to be used willy-nilly for
general backup with errors not being flagged. (One thing that
would tend to save me from even trying to do that is that the thumb
drive has yet to be made that would hold every file in my
C: partition :) )
file
 
A

Anthony Buckland

Twayne said:
Nope, that's a decent methodology and works well for many. Too bad it
can't handle system files too<g>, but ...

Xcopy bases what it will copy (or not) on the status of the Archive bit on
a file. On, copy; off, skip. So it works pretty well for incremental
backups.

If you're up to the task, there's an even more powerful extended version
of xcopy called XXCopy (found ta xxcopy.com logically enough), it's free,
uses all the same syntax xcopy has and then goes on to add a kajillion
other valuable and useful features such as progress bars and many other
things xcopy is missing. It's list of switches is incredibly long though;
you don't memorize them, you just research them and write your batches
accordingly<g>. Oh, it's free or pay and the pay version is cheap at
that. Great documentation too.
I use it instead of xcopy for my "lotsa changes" & "incredibly
important" backups rather than waiting for my imaging program to process
them; it's sort of a versioning system for me on top of backup. Every
file gets the date/time prepended to it for that purpose. That way
they're always handy on a disk: The batch file now even calculates the
size of the backups and alerts me when it's time to burn them to a DVD and
start re-collecting them.

Either program, a batch file is definitely the way to execute them. Then
make an icon for it and just trigger it from windows desktop when you need
to.

Personally I don't really see any drawbacks or cons to either program if
they fit the bill for what needs to be done. At first I had a problem in
that the backup would get too big for a cd, so I switched to DVD, and then
had to add the little alert to let me know the backup was getting too big
for a DVD. XXCopy made that easier, too. I'm looking into a dual layer
DVD right now so the saga continues<G>. On a good day I'll run it up to a
dozen or so times, depending.

HTH

Twayne

Thanks, that's very useful information.
 
P

Pegasus \(MVP\)

But I agree, XCOPY is a technique not to be used willy-nilly for
general backup with errors not being flagged. (One thing that
would tend to save me from even trying to do that is that the thumb
drive has yet to be made that would hold every file in my
C: partition :) )
file

It is up to you to flag or not to flag errors under xcopy.exe. The
following code snippets will give you a full report:

xcopy "Source Folder" "Target Folder" 1>c:\copy.log 2>c:\error.log
xcopy "Source Folder" "Target Folder" 1>c:\copy.log 2>&1

When backing up files with an automatic process then it is
mandatory to examine the backup log regularly, e.g. once
every week. Without this examination the process cannot
be relied upon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top