1

I'm trying to write a robocopy command to copy from folders SR to DS.

Folder DS might have files that already exist in Folder SR, but if Folder DS is updated, don't overwrite it. If folder/files don't exist in folder DS, copy them, keep the same security permissions (shared and NTFS) and timestamp on the files/folders.

I've tried:

Robocopy Source Des /XN /E

The problem is it keeps overwriting the data and another problem is that I have a long pathname over 320 characters which robocopy won't copy.

  • Please see RoboCopy /? – JW0914 Jan 23 at 14:36
1

I think the /XN is the problem , please check this link: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy#remarks as we know that : /xn = Excludes newer files.

/E = Copies subdirectories. this option includes empty directories.

  • I think you need to use a different switch check :

/maxlad:Specifies the maximum last access date (excludes files unused since N).

/minlad:Specifies the minimum last access date (excludes files used since N) If N is less than 1900, N specifies the number of days. Otherwise, N specifies a date in the format YYYYMMDD.

-- for the issue of long path name , I have a solution but it will take much time , so to not consume more time any of GUI tools that solve this problem easily , try to google rsync , gsrichcopy 360 or teracopy , the good news that also these can solve the issue of the recent files or updated one , but first check my solution that I mentioned above

| improve this answer | |
  • Your solution can be applied, good results till now, after searching I found that both the 2 softwares teracopy and gs richcopy 360 are considered as a good solution to long path names issues, so before switching to robocopy alternative what is the solution that will take much time? to see if I have any chance to apply – SandoraKiam Jan 28 at 10:33
  • check this link stackoverflow.com/questions/29865863/… – JulianMota Jan 30 at 12:40
  • Also, take care that rsync is built to run on Unix-like systems, teracopy and gs richcopy 360 are for windows ...first just try the solution at the link that I mentioned and feed me back – JulianMota Jan 30 at 12:44
  • I followed your link and tried to apply, it helped me for 288 characters length, not more, I have info about teracopy , what about the other program? – SandoraKiam Feb 5 at 13:01
  • as per my experience, it is a great solution for long path names problem, also it provides byte-level file replication to save on bandwidth and file copy time, and it gives you a report, logs, also it can copy only modified files and on real-time files, good GUI – JulianMota Feb 7 at 12:21
1

You can try to copy from Folder DS to Folder SR -- with the option to copy only newer files. Then copy Folder SR to Folder DS. It sounds as if there might not be too many files in Folder DS which are newer, and so this won't add much time.

And in the end, both folders would be completely up to date.

This really depends on the details of your need, but might be what you want to do.

This is a solution which you can try to apply or you can switch to robocopy alternatives which are mentioned by other users.

| improve this answer | |
  • it seems that it will take many commands to apply, I think that I will use a GUI program, what do you suggest? – SandoraKiam Feb 5 at 12:53
  • did you apply my solution? for the software recommendation, I think that gs richcopy 360 affordable for you as a long path names solution – SaraWellyIT Feb 16 at 13:12
  • No, but gsrichcopy360 was amazing today with all the problems that we faced like long path names, copying updated files only and copying permissions. – SandoraKiam Feb 18 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.