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 ?
rossonerisAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
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!
0
 
sammySeltzerCommented:
I am attaching the code I use.

All you need is schedule it and it will always copy from one folder to another
ugaBKscript.vbs
0
 
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

~bp
0
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.

 
TelxonCommented:
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!
0
 
arch-itectCommented:
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

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

From novice to tech pro — start learning today.