How do I copy files from the source with different dates than the destination using the Command Line

Mark S

So I am not able to find a switch in Robocopy or xCopy that lets me copy files from the source to the destination, only if the date of the file is different. Regardless if that file is newer or older than the one in the destination.

Situation 1: It should skip any files in the destination that match the date in the source. But if there is a older file in the destination than in the source, it will copy that.

Situation 2: Further, if there is a newer file in the destination than the source, it will copy that one as well.

I see there is a switch to do the former but I don't see one for the second situation.

Unfortunately, the xCopy /d switch will not work in this case either. Does anyone have any ideas on how I can do this?

I would prefer the answer to be in batch programming but if it is in Powershell, vb.NET, or C#, that's okay too. Any advice will be welcome.

Thank you!

Mark

Mark S

After a long time, I finally figured out the answer I was looking for yesterday. It is...

ROBOCOPY /XX /MIR YourSourceFolder YourDestinationFolder

It's a combination of both the /XX and /MIR switches with RoboCopy.

The /XX switch will not allow RoboCopy to touch any extra file that already exists in the folder.

Then, the /MIR switch will bring a mirror copy from the SourceFolder to the DestinationFolder. Date and times will match in both folders. Amazing!

My mistake before was that I was attempting to just find a single switch that would do this for me rather than combining available switches.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I only copy files to a destination that exist in the folder from the source, everything else should not be copied

From Java

Copy files from source to destination but deleting any files in destination but NOT in source

From Dev

How to copy a file to a destination only if the source file is newer than any of the destination files?

From Dev

How do I copy top X files from a directory to another using terminal command?

From Dev

How do I copy top X files from a directory to another using terminal command?

From Dev

How to copy a number of files using command line?

From Dev

How do I convert .doc files to .txt using LibreOffice from the command line?

From Dev

How do I move all files from one folder to a subfolder except .html file using the command line?

From Dev

How do I only copy files to a remote folder on another server that don't already exist in the folder... from the command line in linux?

From Dev

How do I easily rename multiple files using command line?

From Dev

How do I easily rename multiple files using command line?

From Dev

How do I upload files using the command line on Windows?

From Dev

How do I compile and link multiple files from the command line?

From Dev

How do I FTP multiple files from the command line?

From Dev

how to sync directories and files from source to destination

From Dev

How do I transcode/compress mp4 source files on the Linux command line?

From Dev

How do i copy every line X line from a bunch of files to another file?

From Dev

How to bash a Copy files from large text file with source and destination values in it?

From Dev

Copy only modified and new files from source to destination in nant script

From Dev

How to copy whole file from command line without changing destination creation time

From Dev

How do I copy a file to a destination with a wildcard?

From Dev

How to recursively copy files using Windows command line

From Java

How do I copy data from one table to another in postgres using copy command

From Dev

Copy Excel from Source to Destination

From Dev

Using the command line "find | grep -wc" how do I return values that are greater than zero?

From Dev

Copy whole folder from source to destination and remove extra files or folder from destination

From Dev

Copy files to a destination folder only if the files already exist. but the source files have a different file extension

From Dev

Take hyperlinks and then copy from source to destination using hyperlink references

From Dev

How do I copy the directory and its folders in windows command line?

Related Related

  1. 1

    How do I only copy files to a destination that exist in the folder from the source, everything else should not be copied

  2. 2

    Copy files from source to destination but deleting any files in destination but NOT in source

  3. 3

    How to copy a file to a destination only if the source file is newer than any of the destination files?

  4. 4

    How do I copy top X files from a directory to another using terminal command?

  5. 5

    How do I copy top X files from a directory to another using terminal command?

  6. 6

    How to copy a number of files using command line?

  7. 7

    How do I convert .doc files to .txt using LibreOffice from the command line?

  8. 8

    How do I move all files from one folder to a subfolder except .html file using the command line?

  9. 9

    How do I only copy files to a remote folder on another server that don't already exist in the folder... from the command line in linux?

  10. 10

    How do I easily rename multiple files using command line?

  11. 11

    How do I easily rename multiple files using command line?

  12. 12

    How do I upload files using the command line on Windows?

  13. 13

    How do I compile and link multiple files from the command line?

  14. 14

    How do I FTP multiple files from the command line?

  15. 15

    how to sync directories and files from source to destination

  16. 16

    How do I transcode/compress mp4 source files on the Linux command line?

  17. 17

    How do i copy every line X line from a bunch of files to another file?

  18. 18

    How to bash a Copy files from large text file with source and destination values in it?

  19. 19

    Copy only modified and new files from source to destination in nant script

  20. 20

    How to copy whole file from command line without changing destination creation time

  21. 21

    How do I copy a file to a destination with a wildcard?

  22. 22

    How to recursively copy files using Windows command line

  23. 23

    How do I copy data from one table to another in postgres using copy command

  24. 24

    Copy Excel from Source to Destination

  25. 25

    Using the command line "find | grep -wc" how do I return values that are greater than zero?

  26. 26

    Copy whole folder from source to destination and remove extra files or folder from destination

  27. 27

    Copy files to a destination folder only if the files already exist. but the source files have a different file extension

  28. 28

    Take hyperlinks and then copy from source to destination using hyperlink references

  29. 29

    How do I copy the directory and its folders in windows command line?

HotTag

Archive