Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Microsoft
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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