Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

xcopy - folder to folder

Posted on 2010-08-20
7
Medium Priority
?
648 Views
Last Modified: 2012-06-21
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 ?
0
Comment
Question by:rossoneris
7 Comments
 

Accepted Solution

by:
Amivit earned 500 total points
ID: 33484479
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
 
LVL 29

Expert Comment

by:sammySeltzer
ID: 33484507
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
 
LVL 59

Expert Comment

by:Bill Prew
ID: 33490117
==> 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:Telxon
ID: 33497888
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
 
LVL 2

Expert Comment

by:arch-itect
ID: 33512879
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
 
LVL 2

Expert Comment

by:arch-itect
ID: 33528926
Hi rossoneris, did this work for you?
0
 

Expert Comment

by:arielks
ID: 33552093
just add the /Y flag (so it would overwrite without prompt)
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Introduction to Processes
Starting up a Project

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question