Operating System - Microsoft
1748204 Members
4171 Online
108759 Solutions
New Discussion юеВ

Simple XCOPY Question - Backup Files

 
SOLVED
Go to solution
Jay Bollyn
Honored Contributor

Simple XCOPY Question - Backup Files

I would like to use XCOPY to backup a folder and all sub folders to another drive. C:\data is the source. H:\data is the destination, which already exists. Here are the requirements:

1. I only want to copy files and folders which are either new since the last backup, or modified. So I use the /A switch;

2. Overwrite existing files with a newer version without prompting, so I use /Y.

The user claims some files which have changed or been created since the last backup do not appear on the destination.

Is my syntax correct?

XCOPY C:\data\*.* H:\data\*.* /A /E /K /Y /Q

This user does not need a full backup program. I think XCOPY is perfect for what he needs.

- Jay

check Facebook
6 REPLIES 6
Ivan Ferreira
Honored Contributor

Re: Simple XCOPY Question - Backup Files

I think that instead of /A you have to use /M. The /M unmark the archive attribute, so next time won't be copied. If the file is changed, then the file will be copied.

The syntax should be:

xcopy /M /E /K /Y /Q c:\data\*.* h:\data\
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Jay Bollyn
Honored Contributor

Re: Simple XCOPY Question - Backup Files

Thanks Ivan,

I think what I need is:

XCOPY C:\data\*.* H:\data /M /E /K /Y /Q

According to 'XCOPY /?', it should be:

XCOPY source destination switches

...which is different from most other commands.

You are right, I should be using /M, not /A.

I'm not sure what the *.* in the destination was doing, but I don't think it should be there, based on the examples I have seen.

I will give this a try next week.

- Jay
check Facebook
Jon Finley
Honored Contributor
Solution

Re: Simple XCOPY Question - Backup Files

Jay,

My understanding, is that either you specify *.* in both cases, or you add in the /I switch.

Are you going to need to also copy the ACL and ownership info? If so, everything looks good, but add in the /O switch.

XCOPY C:\data\*.* H:\data /M /E /I /K /Y /Q /O

And, if these are critical files you might want to think about verifying the copy by using /V.

XCOPY C:\data\*.* H:\data /M /E /I /K /Y /Q /O /V

Jon
"Do or do not. There is no try!" - Yoda
Jay Bollyn
Honored Contributor

Re: Simple XCOPY Question - Backup Files

Hi Jon,

I think you are right about *.*. I believe I understand that syntax now.

I think this will do what I need:

XCOPY C:\data\*.* H:\data\*.* /M /E /K /Y /Q

Perhaps the user was not pressing F5 to refresh the destination file list.

- Jay

check Facebook
Jay Bollyn
Honored Contributor

Re: Simple XCOPY Question - Backup Files

I think this is probably resolved. If not, I will reopen.
check Facebook
Jay Bollyn
Honored Contributor

Re: Simple XCOPY Question - Backup Files

.
check Facebook