xcopy - folder to folder

I am looking for a xcopy solution so I can copy C:\test to d:\test - .
First time it is running it copy everything, but afterwards it just has to take the changes since to first backup

Can anyone help ?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

AmivitConnect With a Mentor Commented:
xcopy.exe C:\test\*.* D:\test\*.* /D
add /E uf you wan't to include subdirectories.
xcopy.exe C:\test\*.* D:\test\*.* /D /E

Hope this works for you!
I am attaching the code I use.

All you need is schedule it and it will always copy from one folder to another
Bill PrewCommented:
==> it just has to take the changes since to first backup

Can you elaborate on what that means?  I can see basically 4 possible situations, can you state what you want to happen in each case?

(1) a file is in both locations and has not changed

(2) a file is in both locations and has changed

(3) a file has been added and only exists in the c:\test folder

(4) a file has been deleted from c:\test, and only exists in d:\test now

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

By default, XCOPY will copy all files. Maybe you're unintentionally telling it to skip the existing files? The syntax I almost always use is XCOPY (sourcepath) (destpath) /C/H/E/R/Y . This continues to copy even if error occur, copies hidden, readonly, empty subdirectories and overwrites existing files without prompting.

Hope this helps!
xcopy c:\test\*.* d:\test\ /M

/M only copies files with the archive attribute set and then sets it off

changing a file switches the attribute on again which qualifies it to be copied with /M

Hi rossoneris, did this work for you?
just add the /Y flag (so it would overwrite without prompt)
All Courses

From novice to tech pro — start learning today.