• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1445
  • Last Modified:

Quick Help on Robocopy please

what we want to do :

1. Shouldn't overwrite from source to destination regardless of the file age or timestamp.
2. Copy files on or after a certain date.
0
Nirmal Sharma
Asked:
Nirmal Sharma
  • 4
2 Solutions
 
Steve KnightIT ConsultancyCommented:
You could just use :
xcopy /d:mm-dd-yy /-y source dest

but for robocopy I think you need:

robocopy /XC /XN /XO /MINAGE:5 source dest

Should exclude changed, newer, older files (i.e. all that exist) and then copy anything newer than 5 days old (or put date in place of it).

Test it with the /L switch to make sure it is copying the correct files, sorry I can't test it at the mo. for you
0
 
Nirmal SharmaSolution ArchitectAuthor Commented:
Does Xcopy overwrite modified files?
0
 
Steve KnightIT ConsultancyCommented:
Not if you use -Y  that is "don't overwrite".
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
Steve KnightIT ConsultancyCommented:
Ignore me there.  Was thinking the other way around -- -Y will just PROMPT to not overwrite.  Not much use!

Steve
0
 
Steve KnightIT ConsultancyCommented:
One sure fire way is to make sure the account you schedule it as BTW only has create / modify rights at NTFS level and no DELETE rights.  Have a go with the robocopy options above.  I will try myself later if I can.

Steve
0
 
ScintillateRichCommented:
Hi

Sorry, not too sure about robocopy, but can be done with xcopy using this command:

xcopy /d:mm-dd-yy /-y < n.txt

Then createa a file called n.txt and put lots of 'n's in it like this:

nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn

or this:

n
n
n
n
n
n

etc...

(You need enough to account for each time it prompts for you to overwrite or not)

This will cause it to prompt on overwrite, and will take the answer from the n.txt file.

I'm just trying this out myself and it seems to be working.

Thanks

Richard
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now